GussieFinch Posted December 22, 2009 Share Posted December 22, 2009 I have a form that was built with HTML. It is working fine. For the sake of my question, let's just say that it has 5 input fields:: name, e-mail address, address, phone number and dog’s name I have this form go to a PHP file that displays the 5 pieces of information and automatically sends an e-mail (containing the information as well as some notes) to me and a confirmation e-mail to the form submitter. This part is working fine also. Now,... I would like to alter the PHP to only display the 5 lines of information so that the person could review it. Then I want to have another submit button right under the user's information which, when clicked, would actually send the e-mails. In other words, the same concept as when you are making an online purchase, and they display all the order information to review before you actually click the final submit button. I am new to coding, and I cannot figure out how to do this easily. If anyone can give me the simple code, or point me to a link with examples, I'd greatly appreciate. Thank you in advance. ~B Quote Link to comment Share on other sites More sharing options...
anthylon Posted December 22, 2009 Share Posted December 22, 2009 It is very easy task. You should include some checking before sending email. So what you need to do is to check if form was submitted by use (I assume you are doing this before sending email). If form was submitted by user than you could use some hidden field to store some value for example: review=1. Example if review = 0 (user didn't made review yet) you should give the summary of entered information for review. Do you understand my idea or you need better explanation? Regards Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 22, 2009 Share Posted December 22, 2009 u can use the cookies to store the values and then delete them once u show them up.. Quote Link to comment Share on other sites More sharing options...
GussieFinch Posted December 23, 2009 Author Share Posted December 23, 2009 anthylon, I understand the concept, especially because I worked in the programming field (the old days of COBOL!) However, I am still quite confused as to how to incorporate it with these languages. Where exactly would I query the hidden field? Or set it up for that matter? PHP, HTML? What do I have a JavaScript forum with the "onclick"? Quote Link to comment Share on other sites More sharing options...
anthylon Posted December 23, 2009 Share Posted December 23, 2009 I am sorry buddy - it wasn't my intent to be rude :-\ English is not my native language. By the way I can't make decision which mouse to order so I am suffering with touch pad on my laptop. Also I feel very ill these days so please be patient with me . Here is some quick code I wrote fast for you (it could be better but you will find out). Hidden field of course needs to be part of your HTML script (inside of <form></form> tags of the form that user will submit. There are some other ways using JavaScript but this one is easier for me to explain . So here you go - I hope this will work for you <html> <head> <title>Form with hidden field - Test by Anthylon </title> </head> <body> <?php if (! isset($_POST['m_text']) ) $preview = '-1'; else $preview = $_POST['preview']; if (isset($_POST['m_text'])) { $m_text = $_POST['m_text']; if($preview == '-1') { $preview = '1'; echo "This is <strong>preview</strong> with option to change:<p>Dear customer, <br>Are you sure you want to save text = <strong>$m_text</strong>? <br>This is your last chance to make some changes </p>"; //put some code here }else{ echo "Information text=<strong>$m_text</strong> stored - Thank you!"; die(); //not smart idead - don't do this ! ... } } else { $m_text = ''; //just to avoid notice "Notice: Undefined variable: m_text in..." echo 'Please type something in the text field below:'; } ?> <form method="POST"> <input type="text" name="m_text" value="<?php print $m_text?>"> <input type="hidden" name="preview" value="<?php print $preview ?>"> </form> </body> </html> Of course if you have form used for shopping (example) and expecting from user to close browser and have an option to continue later than you should use cookies as ym_chaitu mentioned. Good luck! P.S. I started with clipper 5.1 Quote Link to comment 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.