1

I want to use GET in PHP and I know how to. The only problem is when I start my page I dont have a ?var=... on it. For example my site is

http://localhost/q/question.php

and in my code is

$num = $_GET['num'];

And I want to assume that if $num == NULL or has not been defined as in the link above.

I will generate a different page. because as example below just determines I am starting the questions in what ever page.

No num variable = Start Generating questions in array.

http://localhost/q/question.php?num=1

2 Answers 2

5
if(isset($_GET['num')){
header('Location: someotherpage.php');  //redirects user to someotherpage.php
//do something
}
else{
//do something else

}
Sign up to request clarification or add additional context in comments.

Comments

1
<?php
   if(isset($_GET['num'))
   {
     echo "is not null";
   }
  else
  {
    echo "is null";
   }

?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.