Can you give me an idea or code for onchange?
I tried this code:
<?php
include ("config.php");
$call_type = mysql_real_escape_string($_POST['call_type']);
$query=mysql_query("SELECT `call_type` FROM `tbl_calltype` WHERE `call_type` = '{$call_type}'") or die(mysql_error());
$result = mysql_num_rows($query);
if ($result == 1){
if($call_type == 'Incoming'){
header ('Location:incoming.php');
}
elseif($call_type == 'Outgoing'){
header ('Location:outgoing.php');
}
else{
header('Location:index.php');
}
}
?>
<html>
<script type="text/javascript">
function handleEnter (field, event) {
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
if (keyCode == 13) {
var i;
for (i = 0; i < field.form.elements.length; i++)
if (field == field.form.elements[i])
break;
i = (i + 1) % field.form.elements.length;
field.form.elements[i].focus();
return false;
}
else
return true;
}
</script>
<body onload="document.form1.call_type.focus();">
<form id="form1" name="form1" method="post" action="">
<select name="call_type" onkeypress="return handleEnter(this, event)">
<option value="Select Call Type">Select Call Type</option>
<option value="Incoming" <?php if($_POST['call_type'] == 'Incoming') echo "selected='selected'"; ?>>Incoming</option>
<option value="Outgoing" <?php if($_POST['call_type'] == 'Outgoing') echo "selected='selected'"; ?>>Outgoing</option>
</select>
</form>
</body>
</html>
But still it did not go to another page