jlee2301
08-09-2004, 12:54 PM
Hi guys
I have a page with a form as folows:
<form name="myform" action="" method="post">
<select name="select">
<option>Add</option>
<option>Delete</option>
<option>Edit Project</option>
</select>
<input type="submit" name="submit" value="Select" onClick="option();"></form>
All I want to do is when somone chooses one of the options in the drop down box, and clicks the submit button, they are taken to the specific page already created for each option. I started off trying javascript and defining the option() function in the header trying something like:
<script language="JavaScript">
function option(){
if document.myform.select.selectedindex == 0
{
window.location="add.php");
}
else if document.myform.select.selectedindex == 1
{
window.location="delete.php";
}
}
etc etc
I just cant get it to work - any ideas?
I have a page with a form as folows:
<form name="myform" action="" method="post">
<select name="select">
<option>Add</option>
<option>Delete</option>
<option>Edit Project</option>
</select>
<input type="submit" name="submit" value="Select" onClick="option();"></form>
All I want to do is when somone chooses one of the options in the drop down box, and clicks the submit button, they are taken to the specific page already created for each option. I started off trying javascript and defining the option() function in the header trying something like:
<script language="JavaScript">
function option(){
if document.myform.select.selectedindex == 0
{
window.location="add.php");
}
else if document.myform.select.selectedindex == 1
{
window.location="delete.php";
}
}
etc etc
I just cant get it to work - any ideas?
