Forum Moderators: coopster

Message Too Old, No Replies

two action= in PHP

         

Kysmiley

4:10 am on Dec 15, 2004 (gmt 0)

10+ Year Member



Is there anyway to setup my script to post to self and also transfer one field to another page. I have a thankyou page and would like to be-able to transfer the name from the form to that page to give a more personal touch after peop0le have filler in the form. the thankyou page would be like thank-you $name for blah blah blah.
The $name would get replaced with the name the users used to fill in the form.
Pat

orion_rus

7:06 am on Dec 15, 2004 (gmt 0)

10+ Year Member



It's not a problem at all. Let's see what u need to have:
Of cause session will be needed
Constant part of code (should be in a both files)
start_session();
$referrer=$_SESSION['url'];
$url=$_SESSION['url']=$_SERVER['PHP_SELF'];

Ur file with $name
if (isset($_SESSION['name'])) {Ur actions when u return to this page} else {
?>
<form action="process.php" method="post">
<input name="name" type="text">
</form>
<?}
Process.php
$name=$_POST['name'];
$name+="hi";
$_SESSION['name']=$name;
header("Location: ".$referrer);

What's all i think
Good luck to you