Quote:
Originally Posted by PaulW
There's nothing in your current code to submit the form - but better still, add an onChange handler to the SELECT tag. Not sure why you have a db query. And always put an exit() after header calls.
|
I tried this code:
PHP 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'); exit(); } elseif($call_type == 'Outgoing'){ header ('Location:outgoing.php'); exit(); } else{ header('Location:index.php'); exit(); } } ?>
<html> <body> <form id="form1" name="form1" method="post" action=""> <select name="call_type" onchange="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> <input type="submit" name = "Submit" value="Submit"> </form> </body> </html>
I add submit button and I put onchange and I also add exit() after header location but when I run my code and I choose Incoming and I click submit button nothing was change, i mean it did not go to incoming.php
Thank you...
|