mikevarela Posted July 25, 2009 Share Posted July 25, 2009 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> Link to comment https://forums.phpfreaks.com/topic/167348-help-form-submits-to-self-redirect-page-upon-customers-page-request/ Share on other sites More sharing options...
jonsjava Posted July 25, 2009 Share Posted July 25, 2009 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> Link to comment https://forums.phpfreaks.com/topic/167348-help-form-submits-to-self-redirect-page-upon-customers-page-request/#findComment-882479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.