Page 1 of 1

php textfield

Posted: Wed Sep 21, 2005 1:51 am
by sebs
How can I pass parameters from one form to another,I read them from a textfield.Thank you!

Posted: Wed Sep 21, 2005 1:52 am
by s.dot
the first textfield will be in $_POST['textfield'] after you submit.

to show it in the second forms textfield use

Code: Select all

<input type="text" value="<? echo $_POST['textfield']; ?>">

Posted: Wed Sep 21, 2005 2:23 am
by sebs
in first form :
<input name="cosa" type="text" class="ricerca" id="cosa" value="cerca" size="40" />
and in second:
<input type="text" value="<? echo $_POST['cosa']; ?>">
Do I have to write something else in the first one to work.Sorry I asked again.

Posted: Wed Sep 21, 2005 2:45 am
by n00b Saibot
sebs wrote:in first form :
<input name="cosa" type="text" class="ricerca" id="cosa" value="cerca" size="40" />
and in second:
<input type="text" value="<? echo $_POST['cosa']; ?>">
Do I have to write something else in the first one to work.Sorry I asked again.
value will appear only after you post the first form

Posted: Wed Sep 21, 2005 3:40 am
by Jenk
*ahem* Sanitisation people!

Code: Select all

<input type="text" value="<? echo htmlentities($_POST['cosa']); ?>">

Posted: Wed Sep 21, 2005 7:17 am
by feyd
don't forget to avoid using short tags!

Code: Select all

<?php ?>
<input type="text" value="<?php echo htmlentities($_POST['cosa']); ?>">

Posted: Wed Sep 21, 2005 9:08 am
by Jenk
Doh!