Re: Pass values through a PHP form emailer



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
.