can someone assist me with fixing the error i'm receiving.
$search_key = '';
/*if(isset($_POST) && ($_POST["fk"])!=NULL){
$search_key = $_POST["fk"];
}elseif(isset($_GET) && ($_GET["fk"]!=NULL)){
$search_key = $_GET["fk"];
}
*/
if(!isset($_POST["fk"])){
$search_key = $_POST['fk'];
}elseif(isset($_GET["fk"])){
$search_key = $_GET["fk"];
}
You have a
!isset
in the first line of the code belowSo if it $_POST["fk"] is not set, it will try to read it. Hence the error message. Just use
isset
instead of!isset
.Just a little side-note: if you want to have the value from either a $_POST or $_GET, you could simply use $_REQUEST['fk']; as $_REQUEST holds the values merged from $_COOKIE, $_POST and $_GET (order depends on your PHP configuration)