php textfield

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sebs
Forum Commoner
Posts: 97
Joined: Tue Sep 20, 2005 10:13 am

php textfield

Post by sebs »

How can I pass parameters from one form to another,I read them from a textfield.Thank you!
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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']; ?>">
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
sebs
Forum Commoner
Posts: 97
Joined: Tue Sep 20, 2005 10:13 am

Post 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.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

*ahem* Sanitisation people!

Code: Select all

<input type="text" value="<? echo htmlentities($_POST['cosa']); ?>">
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

don't forget to avoid using short tags!

Code: Select all

<?php ?>
<input type="text" value="<?php echo htmlentities($_POST['cosa']); ?>">
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Doh!
Post Reply