How do i make a HTML form redirect to different pages based on responses to a form?
November 8th, 2009 | by admin |I have a html form with two drop down boxes with the options ‘Yes’ and ‘No’ in each. When submitted, i want the form to direct the user to one page if both responses are yes, and another page if either response is no. Can anyone give me some very simple guidelines on how to do this, or where i could find a nice tutorial about it?
check out these HTML tutorial videos .. with they r helpful ![]()
http://www.mytopclip.com/search.php
Tags: Check Html, Drop Down Boxes, Html Pages, Html Redirect, Html Tutorial, videos
By Andy Softy! on Nov 8, 2009
check out these HTML tutorial videos .. with they r helpful
http://www.mytopclip.com/search.php
References :
By Chris C on Nov 8, 2009
Use Javascript.
<html>
<script type="text/javascript">
function switchit()
{
var frm = document.forms[0];
if (frm)
{
if ((frm.myfield1.value = "no") || (frm.myfield3.value = "no"))
return 0;
else
{
// change the action for the form to a different web page and submit it
frm.action="someotherpage.php";
frm.submit();
}
}
}
</script>
<body>
<form action="switchit();" type="post">
<select name="myfield1">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<input type="text" name="myfield2">
<select name="myfield3">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</form>
</body>
</html>
References :
By colanth on Nov 8, 2009
You can use Javascript window or php header(location:
References :