|
Posted by Khai on 11/17/05 18:12
So, can I post variables to another page without user interaction?
Say, I have 3 different pages linked off the primary page, and each link
needs the same or different information for different purposes.
Can I programmatically tell it which vars to pass, without having someone
click on something other than the <a href>?
*starting to understand*
...i think.
-Khai
----- Original Message -----
From: "ZeldorBlat" <zeldorblat@gmail.com>
Newsgroups: comp.lang.php
Sent: Thursday, November 17, 2005 9:30 AM
Subject: Re: Passing Variables
> >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.
>
Navigation:
[Reply to this message]
|