ackg37 Posted January 8, 2010 Share Posted January 8, 2010 I have a functioning contact form. I want to add a redirect; right now it automatically redirects to the index page. However, the 'onsubmit' attribute is already being used to validate the form. I can't alter the php script the form uses, so have to do all this from my end. How else could I keep form validation or tell it where to redirect on submission? The code is included below. Thanks! In the head: <script type="text/javascript"> function checkForm(frm){ msg = ""; if(!frm.name.value){ msg += "- Name is required\n"; } if(!frm.email.value){ msg += "- Address is required\n"; } if(!frm.location.value){ msg += "- Email is required\n"; } if(!frm.schedule.value){ msg += "- Email is required\n"; } if(!frm.likes.value){ msg += "- Email is required\n"; } if(!frm.dislikes.value){ msg += "- Email is required\n"; } if(msg != ""){ alert(msg); return false; } } </script> In the table: <form action="/webformmailer.php" method="post" onsubmit="return validate_form(this)> input type=hidden name="required" value="email,phone"> Link to comment https://forums.phpfreaks.com/topic/187655-contact-form-how-to-redirect-on-submit/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.