Jump to content

passing infromation from self-submission form to new page when successful


errcricket

Recommended Posts

i am stumped on a 2 problems. i have a file (formTest.php) that contains a form (using post method). the input will eventually be added to a database, so i am using self submission for security/completion check. this works swimmingly (database insertion as well as echoing of properly filled input).

upon successful submission, i would like a new page (success.php) to open with a little message - "Thank you (INSERT NAME HERE) for your submission, and email has been sent to (INSERT ADDRESS HERE)" and emails sent to both me and the user.

 

<?php
...
if(mysql_affected_rows() == 1)
		{

			$message = "<P>Thank you $tr_nameF for your submission, a confirmation email has been sent to $tr_email.</P>"; //will remove once success page works properly
			$noform_var = 1;	
			unset( $_SESSION['form_token']);   
			echo '<meta http-equiv="refresh" content="2;url=https://secure****/success.php"/>';  
			mail ('[email protected]', 'From Submission', 'Someone has submitted a form.');			
		} //end affected rows
		else
		{
			error_log(mysql_error());
			$message = '<P style="color:red">We are sorry, but there was a problem with your submission. Please contact the office or try again at a later time.</P>';
...
?>
...
<body>
...
<form name="form" method="post" action="formTest.php">
...
First Name: <input type="text" id="firstName" name="nameF" size="16" maxlength="15" value="<?php if (isset($_POST['nameF'])) echo $Fname; ?>">
...

 

how do i pass the users name and address onto a new file as well as sending emails? i tried to use the following in the success.php file but it does not display the variables.

 

<?php  
$name = $_POST['nameF'];
$mail = $_POST['eMail'];
?>

<body>
...
Thank you <?PHP echo $name; ?> TESTING: Thank you for your submission, a confirmation email has been sent to <?PHP echo $mail; ?>.
...

 

thanking you in advance.

 

how do i pass the users name and address onto a new file

 

Using of the below two methods:

1) point your form to that file ($_POST or $_GET).

2) use the superglobal $_GET to pass these variables

thanks for the quick reply. i did just notice i used POST rather than GET on the success page, but i cannot post to success because i have placed on the functions/checks data scrubbing in the original file - which is why i am posting to it, but let me try the GET to see if that _GET(s) me anywhere.

 

...get it? this thing on?

...i am here all week. unfortunately changing to

 

<?php  
$name = $_GET['nameF'];
$mail = $_GET['eMail'];
?>

 

did not change the success.php output. other suggestions? i am missing something really obvious? and i have yet to receive any emails using the mail function...again ideas?

maybe there is a different problem lurking somewhere...i have tried several different things and nothing is working.

 

this stares out at me from the success.php page...

"Thank you for your submission, a confirmation email has been sent to ."

Thank you <?PHP echo $name; ?> for your submission, a confirmation email has been sent to <?PHP echo $_POST['eMail']; ?>.

 

recall that

<?php  
$name = $_POST['nameF'];
$mail = $_POST['eMail'];
?>

& in the original file....

echo '<meta http-equiv="refresh" content="2;url=https://secure.xxx.com/xxx.org/success.php?nameF=<nameF>&eMail=<eMail>"/>'; 

First Name: <input type="text" id="firstName" name="nameF" size="16" maxlength="15" value="<?php if (isset($_POST['nameF'])) echo $Fname; ?>">

Email: <input type="text" id="elecMail" name="eMail" size="15" maxlength="40" value="<?php if (isset($_POST['eMail'])) echo $eMail; ?>">

 

am i missing something????

 

 

 

 

 

good plan...

 

but now i am getting this error...

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /secure/Test.php on line 591

 

echo '<meta http-equiv="refresh" content="2;url=https://secure.xxx.com/xxx.org/success.php?nameF=$_POST['nameF']&eMail=$_POST['eMail']"/>';

 

i can think of some places i would like to stick a ',' or';' (  >:(  ;)  ), but none of those or the host of things i have tried get rid of the error. thoughts?

good plan...

 

but now i am getting this error...

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /secure/Test.php on line 591

 

echo '<meta http-equiv="refresh" content="2;url=https://secure.xxx.com/xxx.org/success.php?nameF=$_POST['nameF']&eMail=$_POST['eMail']"/>';

 

i can think of some places i would like to stick a ',' or';' (  >:(  ;)  ), but none of those or the host of things i have tried get rid of the error. thoughts?

 

I thought you would now what to do with them.

<?php
$nameF = $_POST['nameF'];
$eMail = $_POST['eMail'];
echo "<meta http-equiv=\"refresh\" content=\"2;url=https://secure.xxx.com/xxx.org/success.php?nameF=$nameF&eMail=$eMail\"/>";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.