Jump to content

Help - Form submits to self, redirect page upon customers page request


mikevarela

Recommended Posts

need a little help.

I have a page with a form and drop down menu with 4 choices. once the user submits the form with one of the choices, i'd like to redirect them to the page they requested.

 

here's the form.

 


<form action="" method="post">

<label for="select_page">Select Page:</label>
<br />
<select name="select_page">
	<option value="wedding_party">Wedding Party</option>
	<option value="playlist_create">Create Playlist</option>
	<option value="playlist_view">View Your Playlist</option>
	<option value="timetable_guidelines">Timetable and Guidelines</option>
</select>
<input type="submit" name="submit" id="submit" value="Submit" />

</form>

this isn't a PHP solution. I figured it would be best to do it the easy way: javascript

 

<html>
<head>
	<script type="text/javascript">
		function getUrl(){
			field1 = document.getElementById("dmenu");
			return field1.value;
		}
		function redirectMe(){
			var url = getUrl();
			if (url.length != 0){
				location.href = "http://your-site.com/"+url+".html";
			}
		}
	</script>
</head>
<body>
	<div id="menu">
		<select name="select_page">
			<option value="wedding_party">Wedding Party</option>
			<option value="playlist_create">Create Playlist</option>
			<option value="playlist_view">View Your Playlist</option>
			<option value="timetable_guidelines">Timetable and Guidelines</option>
	   </select>
	</div>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.