snottrocket Posted March 20, 2011 Share Posted March 20, 2011 That's really the only way i can categorize this particular question. I have a site loading a form into an iframe. probably not the smartest thing to do but I've built a one-page portfolio site that scrolls to each anchor point with the scrollTo script. None the less, my form loads into my frame. I started thinking about usability and how odd it might be to a non-techie, non-webby visitor to go to the form, submit and then maybe want to send another message. Although not very probable, it's the stuff we don't anticipate happening that usually gets us in deep. Really, what I'm looking for is something where after the visitor submits the form and it says "thank you for sending us an email" that it would either automatically reset my index page OR give the visitor the option of manually resetting the page. my form <form method="POST" action="mailer.php"><br /> Name:<br /> <input type="text" name="name" size="50"><br> <br /> E-Mail:<br> <input type="text" name="email" size="50"><br> <br /> Comments:<br> <textarea wrap="soft" rows="5" name="message" cols="48"></textarea> <br> <br> <input type="submit" value="Submit" name="submit"> </form> php script <?php if(isset($_POST['submit']) || isset( $_POST['submit_x'] )) { $to = "email@mydomain.com"; $subject = "Contact from a visitor"; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $body = "From: $name\n E-Mail: $email\n Message:\n $message"; echo "Your email has been sent to $to!"; mail($to, $subject, $body); } else { echo "blarg!!!"; } ?> Quote Link to comment Share on other sites More sharing options...
Krash Posted March 21, 2011 Share Posted March 21, 2011 Depending on how you want it to work, there are two things you can try: Add a Reset button to the form, so the user can manually reset - <input type="reset" value="Reset" name="reset"> Add an onLoad reset to the <body> tag so the form resets automatically when the script executes and reloads it - <body onLoad="document.forms['formname'].reset();> Quote Link to comment Share on other sites More sharing options...
snottrocket Posted March 29, 2011 Author Share Posted March 29, 2011 so that would go in the parent html file...the one with the iframe...or would it go in file that the form lives in. How would that work with regards the "thank you for sending us an email" message? 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.