Am I correct in thinking that...
--you want to check if the "call_type" is a valid page
--if so, redirect to that page
?
If so, there are two options for you:
1) hard code.
--if the only options are "incoming" and "outgoing", and you don't plan on changing the options often, you can simply verify that the "call_type" is one or the other:
PHP Code:
// make an array containing the allowed values
$allowed_types = array('Incoming','Outgoing');
// check if the call_type is submitted, and (if so) that it matches one of the allowed values
if (isset($_POST['call_type']) && in_array($_POST['call_type'], $allowed_types)) {
// if so, set the appropriate header()
// you can use the value directly if it's the same as the filename
header("Location: http://www.example.com/path/to/".$_POST['call_type'].".php");
}
looking at your example above, that's more than sufficient for what you're doing. however, you should use the database if you want the allowed pages to be more flexible:
PHP Code:
if (isset($_POST['call_type'])) {
// escape the value
$call_type = mysql_real_escape_string($_POST['call_type']);
$result = mysql_query("SELECT `call_type` FROM `tbl_calltype` WHERE `call_type` = '{$call_type}' ");
// if there's one row in the result, then there was a match.
if(mysql_num_rows($result) === 1){
// send the header()
header("Location: http://www.example.com/path/to/".$call_type.".php");
}
}
Bookmarks