errcricket Posted July 10, 2009 Share Posted July 10, 2009 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 ('xxx@xxx.com', '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. Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/ Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-872997 Share on other sites More sharing options...
errcricket Posted July 10, 2009 Author Share Posted July 10, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873004 Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 ...get it? Yes, I _GET your _POST Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873013 Share on other sites More sharing options...
errcricket Posted July 10, 2009 Author Share Posted July 10, 2009 ...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? Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873017 Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 did you use this format? success.php?nameF=<nameF>&eMail=<eMail> Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873023 Share on other sites More sharing options...
errcricket Posted July 10, 2009 Author Share Posted July 10, 2009 no...i will try it...will that be a problem - i.e. will the person's name and e-mail appear in the browser address? ...trying right....now... Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873026 Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 will the person's name and e-mail appear in the browser address? Yes it will. If that is a problem you can alter it to POST if you use a form. Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873031 Share on other sites More sharing options...
errcricket Posted July 10, 2009 Author Share Posted July 10, 2009 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???? Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873038 Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 https://secure.xxx.com/xxx.org/success.php?nameF=<nameF>&eMail=<eMail> should be: https://secure.xxx.com/xxx.org/success.php?nameF=$_POST['nameF']&eMail=$_POST['email'] Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873050 Share on other sites More sharing options...
errcricket Posted July 10, 2009 Author Share Posted July 10, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873088 Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 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\"/>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-873128 Share on other sites More sharing options...
errcricket Posted July 13, 2009 Author Share Posted July 13, 2009 hmmm... well, this modification does not have any errors associated with it, but i am afraid to say that the information (name/email) is not successfully transmitted to the next page. any other suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/165520-passing-infromation-from-self-submission-form-to-new-page-when-successful/#findComment-874715 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.