2

I am running a PHP script, and keep getting errors like:

Notice: Undefined index: search in C:\server\data\localweb\easy_ticket\admin\view_tickets.php on line 188

Line 188 looks like this:

if ($_GET["search"] || $_GET["filter"] && $_GET["f"]- && $_GET["sortby"]) {

After googling this issue I got this solution .. Using isset()
The problem is that I cant visualize the way I apply this to the code .. @.@

2 Answers2

1

Yes you should use isset construct separated by commas..

if (isset($_GET["search"],$_GET["filter"],$_GET["f"],$_GET["sortby"])
{
    // All variables have been set... do your coding stuff below
} else { echo "Some of the variables are not set"; }
Shankar Narayana Damodaran
  • 68,075
  • 43
  • 96
  • 126
0

try this

if ((isset($_GET["search"]) || isset($_GET["filter"])) && (isset($_GET["f"]) && isset($_GET["sortby"])) {
Arun Kumar
  • 1,607
  • 1
  • 18
  • 33