form and submit key

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

one thing more.

Say, I have a <form> with a text input and a submit button - how do I
then get the data when reloading or how?

Sorry, this is probably simple... but to me it is new.


Re: form and submit key

Sonnich schrieb:
Quoted text here. Click to load it

If you have for example

--snip 1.php--
<form method=post action=2.php>
<input type=text name='something'>
<input type=submit value='Send'>
--snap 1.php--

you can read the contents of the text-field in 2.php by using  

So for example you could do

--snip 2.php--

echo "Hello ". $_POST['something'] ."!";

--snap 2.php--

Re: form and submit key

On 7 Jul 2006 02:00:47 -0700, Sonnich wrote...
Quoted text here. Click to load it

Depending if your form uses the "get" or "post" method, the values of the
submitted form would be stored in either $_GET['field1'] or $_POST['field1'].
The trick is the data is store when the form is submitted. If you are reloading
a page though, it will load it's original state, so if you are starting with a
blank form, you'll get a blank form.

If you are submitting the form and doing your basic security and form
validation, you can use the $_GET or $_POST variables as the values for your
form fields. Something like this maybe...

<input type="text" name="field1" value="<%=$_POST['field1']%>">

Newsguy Express $9.95 monthly

Site Timeline