|
Posted by ZeldorBlat on 11/17/05 17:30
>I'm trying to pass variables, and can do so just fine with a URL, and $_GET.
>What I would like to learn, and be very adept at using is the Form functions
>and how you pass through that.
>
>The problem in my comprehending this, is how does the original page know how
>to post the data to the new page? Or do you create the form on the original
>page, and somehow, magically, the new page can read from it?
Yes -- you create the form on the original page and specify where the
form should be submitted. Suppose on page1.php you had something like
this:
<form action="page2.php" method="post">
<input type="text" name="foo"/>
<input type="submit" name="submit" value="Submit"/>
</form>
So when someone fills in this form and hits submit, the browser will
post the form data to page2.php. On page2.php you can access foo and
submit through the $_POST superglobal (in exactly the same way you get
to the GET variables). Also note that there is nothing that prevents
you from putting the current page into the "action" attribute -- that
is, it is perfectly valid (and often quite useful) to have a page with
a form post to itself.
[Back to original message]
|