PDA

View Full Version : dropdown menu and button


red_rose
12-12-2006, 04:24 PM
hello. i would like to ask something regarding the dropdown menu. i have a dropdown menu and also a button in my page. when an item is selected from the menu, then the button is clicked so that it will redirect the user to the selected page, but not in a new window. i want the page to be opened in the same window. here is the current code, what changes do i need to make in order to meet my needs? the PHP page is saved as 'newpage.php'. thanks alot




<script language="javascript" type="text/javascript">
function goto() {

var win = document.getElementById('inst');
var newWindow = window.open(win.value, 'newWin', '_parent');
newWindow.focus();

return false;
}
</script>
</head>
<body>

<form name="form1" method="post" action="newpage.php">
<select name="inst">
<option value="" selected>Select Instituition</option>
<?php do { ?>
<option value="<?php echo $row['Inst_Id']; ?>"><?php echo $row['InstName']; ?></option>
<?php } while ($row = mysql_fetch_array($result)); ?>
</select>
<input name="Go" type="submit" id="Go" value="Go" onClick="goto()">
</form>

</body>
</html>

red_rose
12-14-2006, 08:42 AM
can anyone help me with this thread? thanks alot

davidj
12-14-2006, 09:05 AM
change this...


var newWindow = window.open(win.value, 'newWin', '_parent');
newWindow.focus();


to


document.location.href="newpage.php";