Forums

textbox value for use it in the same form?

whiskises 01 Aug, 2010
Hi people
I want to use the value entered in a textbox to add a link located on the same form ... pagelink&id= textbox_value
I've tried in many ways, including:
'.. Pagelink & id = <? Php echo JRequest:: getVar (' text_1 ');?>'
did not work

How can I do? How can I capture the value of a textbox for use it in another place of the same form?
I have read many post and may not be very difficult for other people, because I have not seen post with this particular problem, but I am stranded here for quite time.
Please help me.Thank very much.
GreyHead 01 Aug, 2010
Hi whiskises,

You can't do it with PHP in the Form HTML box as that code is executed before the form is sent to the browser so it can't contain any information that the user inputs.

You could do it with a two page form and show the link after the form is submitted.

Or you could add a small snippet of JavaScript to create the link and disply it once an entry is made in the text input.

Bob
whiskises 01 Aug, 2010
Ok,it´s out one form, but even with two forms, how I can retrieve the contents of the textbox on the first form and sent to the second form?
Would you mind putting an example. Thank you very much for responding so quickly
whiskises 01 Aug, 2010
I'll do it,Thank you very much, I used two forms,as you said: at the first i changed the Form's "action" URL for the destination is the second form and in this form picked up the textbox value with php, <? Php $id = $ _POST ["text_1"]; ?> And show the link.
thank you another time.
This topic is locked and no more replies can be posted.