gazfocus Posted May 10, 2008 Share Posted May 10, 2008 I have got a contact form on my site that I'm making but I want the query in the form to be sent via email to myself but also for the page to then redirect to a page notifying the user that the information has been sent. Is there a way to do this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/ Share on other sites More sharing options...
p2grace Posted May 10, 2008 Share Posted May 10, 2008 You'd need some sort of server-side language to do all of the processing and the sending of the email Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/#findComment-537669 Share on other sites More sharing options...
stebbi Posted May 10, 2008 Share Posted May 10, 2008 Do you want somthing like this http://cardiffroyalcabs.com/booking.htm Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/#findComment-537691 Share on other sites More sharing options...
ondercsn Posted May 10, 2008 Share Posted May 10, 2008 i use javascript like this : if login conditions are ok then : <script language="javascript"> parent.location.replace ('index.php'); /* or document.location.replace ('index.php') document.refresh(); </script> Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/#findComment-537699 Share on other sites More sharing options...
gazfocus Posted May 10, 2008 Author Share Posted May 10, 2008 i use javascript like this : if login conditions are ok then : <script language="javascript"> parent.location.replace ('index.php'); /* or document.location.replace ('index.php') document.refresh(); </script> Thanks, but what I'm looking for is some way of redirecting only when the contents of the form have been emailed using <form action="mailto:[b]email address[/b]" method="post" name="query"> Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/#findComment-537717 Share on other sites More sharing options...
TheFilmGod Posted May 10, 2008 Share Posted May 10, 2008 <?php // If form was submitted if ( isset($_POST['submit'])) { ... validate form and send email to you. } // Form not submited else { ?> <form action="<?php echo"$_SERVER['PHP_SELF']"; ?>" method="post"> ... form crap <input type="submit" name="submit" value="Submit" /> </form> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/#findComment-537840 Share on other sites More sharing options...
ondercsn Posted May 10, 2008 Share Posted May 10, 2008 then you can use the javascript code as a javascript function and control it in onSubmit() event of <form> tag. <form onSubmit="redirect()"....> i don't know that is an exact solve. just a way... Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/#findComment-537868 Share on other sites More sharing options...
TheFilmGod Posted May 12, 2008 Share Posted May 12, 2008 then you can use the javascript code as a javascript function and control it in onSubmit() event of <form> tag. <form onSubmit="redirect()"....> i don't know that is an exact solve. just a way... You don't need to use javascript. Find a tutorial online to see how php would redirect. But in the example I gave, it is not needed since it would show up different results depending on if the form was or wasn't submitted. Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/#findComment-538607 Share on other sites More sharing options...
Cory94bailly Posted May 12, 2008 Share Posted May 12, 2008 Thanks, but what I'm looking for is some way of redirecting only when the contents of the form have been emailed using <form action="mailto:[b]email address[/b]" method="post" name="query"> That is a horrible way to mail.. I suggest use the php mail() function. Quote Link to comment https://forums.phpfreaks.com/topic/105017-submitting-a-form-and-redirecting/#findComment-538692 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.