|
Posted by juglesh on 10/01/05 21:31
Stewart wrote:
> "Marc" <mbradshaw@beasolutions.com> wrote in message
> news:1128069898.19465.0@eunomia.uk.clara.net...
> > Stewart wrote:
> > >>>I have a very basic PHP script that emails forms submitted to it.
> > >>>It has a success page/URL feature.
> > >>>I'd like to learn how to modify this script to pass certain vales onto
> > >>>the success page.
> > >>>
> > >>>So the URL to my destination page may be in this format:
> >
> > This is exactly what I have given you - no PHP (or JavaScript for that
> > matter) is required to produce a page "to pass certain values onto the
> > success page. So the URL to my destination page may be in this format:"
> >
> > >>>
> http://www.test.com/passing-values-source2.htm?firstname=Amanda&lastname=Wilson&age=77
> >
> > All you need to do is add three <input /> tags to the form HTML below,
> > and you'll get a URL exactly like that above.
> >
> > >><form method="get" action="passing-values-source2.htm">
> > >>
> > >>... form input tags here ...
> > >>
> > >></form>
> >
> > Then you said...
> >
> > > This won't pass through my PHP script wll it?
> > >
> > > This encloding would have to be in the script I think.
> >
> > I have no idea what you're trying to say here... 'pass through my PHP
> > script' means nothing... and 'encloding' (encoding?) has nothing to do
> > with anything.
> >
> > Do you mean you want to access the values within the PHP script? If you
> > just wanted to display them, you can use the following HTML and PHP:
> >
> > <p>First name: <?= $firstname ?></p>
> > <p>Last name: <?= $lastname ?></p>
> > <p>Age: <?= $age ?></p>
> >
> > That is assuming you'd called the <input>s on the first HTML page
> > firstname, lastname, and age, and therefore had a URL with the same
> > query string (the bit after the ?) as that above.
> >
> > Marc
>
> I'm sorry I don't know all the correct terminology, that is part of what I'm
> hoping to learn Marc.
> I'm sorry, but I considered a value entering And exiting a script "passing
> thru".
>
> I have spoken to people knowing little about PHP, and they understood how
> values can be appended to a URL. This is commonly how values are passed
> between web pages. Example:
> http://www.domain.com/page.htm?name=Andrea&email=andrea@aol.com&message=textmessage
>
> The destination URL would then contain a function that would parse the
> appended information for display and/or passing to next URL.
>
> This may help you understand my objective:
> http://javascript.internet.com/forms/passing-values.html
To 'parse the appended information', you need to use $_GET['name'] and
$_GET['message']. Marc gave you the way to pass user input from the
form to the page that will do something with that info. A little
clearer, maybe:
<form method="get" action="passing-values-source2.htm">
put yer name here:<input type="text" name="name">
put yer message here:<input type="text" name="message">
<input type='submit'>
</form>
fill that out, and you will arrive at passing-values-source2.htm,
(please note, if you want to do any php in the 'action' file, it's
going to have to be filename.php -**php**)
with a query string appended:
?name=mynameisjuglesh&message=hellostewart
note the name of the query string item is the same as the name as your
<input> element.
The .php file that is in the action of the form may look like this:
echo 'Today,'.$_GET['name'].' said to me: ".$_GET['message'] ;
// Today, juglesh said to me: hellostewart
hth,
--
juglesh
Navigation:
[Reply to this message]
|