Actually, two totally separate items...
The first sets the form field name. You have an input field, and it is
called "whatever".
The second is setting the VALUE of the form field. From the looks of,
it's getting the data submitted from another form. $_POST['first_name']
is taking the value of "first_name", submitted via a form that was
posted.
An example of using these together would be
<form method="post" action="results.php">
<input type="text" name="first_name" />
<input type="submit" />
</form>
on a form. The use enters their first name, and whacks the submit
button. On the next page (results.php), you could display something like
Hello <?=$_POST['first_name'] ?>, how are you today?
That would echo the value of the form field "first_name" that was
submitted. Keep in mind that the variable would only contain data if the
form was submitted via POST (and not GET), and you have a form field
named "first_name".
Hope this makes sense.
-----Original Message-----
From: Joseph Harris [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 11:10 PM
To: [email protected]
Subject: [wdvltalk] values in forms with php
I am just settling in my mind conflicting ways of dealing with forms.
In one the user box is identified by name="whatever" and that is dealt
with by the action file.
The other is something like this: value="<?=$_POST['first_name'];?>"
also dealt with by the action file.
Am I right in thinking the second would be used where there is a range
of
options to select from. I have an example which, as there is no list,
produces a notice of an unidentified variable and also shows the php
code in the textbox.
Is there a reason for using the second version where the form is filled
with new information?
TIA
Joseph Harris
____ * The WDVL Discussion List from WDVL.COM * ____ To Join wdvltalk,
Send An Email To: mailto:[EMAIL PROTECTED] or use
the web interface
http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: [email protected] To change
subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED] To
unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.
____ The WDVL Discussion List from WDVL.COM ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.