chriscounter07
asked on
Can someone help me understand this syntax
Hi,
Just a quick one, can anyone help me understand these few lines..
if ((!isset($_GET["cPath"]) or $_GET["cPath"]=="") && (!isset($_GET["keywords"]) ))
{
header("Location: home page ");
}
(I've put in home page)
thanks
Just a quick one, can anyone help me understand these few lines..
if ((!isset($_GET["cPath"]) or $_GET["cPath"]=="") && (!isset($_GET["keywords"])
{
header("Location: home page ");
}
(I've put in home page)
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is a lesson:
1. An exclamation point ! means NOT.
2. $_GET is a method used by a form. The alternative is $_POST. These are used in a form such as <form name="form1" action="" method="get">
3. == means equals.
4. double quotes "" means empty string
5. && means AND
6. isset means is set as in ... the variable keywords is set to monkey blood
So, if you place an exclamation point in front of isset then !isset would mean: not set or also known as an empty string. The first part of your code means the same thing which is not necessary to have both:
((!isset($_GET["cPath"]) means the same things as
$_GET["cPath"]=="") because !isset (variable not set) means the same thing as "" (variable equals and empty string)
1. An exclamation point ! means NOT.
2. $_GET is a method used by a form. The alternative is $_POST. These are used in a form such as <form name="form1" action="" method="get">
3. == means equals.
4. double quotes "" means empty string
5. && means AND
6. isset means is set as in ... the variable keywords is set to monkey blood
So, if you place an exclamation point in front of isset then !isset would mean: not set or also known as an empty string. The first part of your code means the same thing which is not necessary to have both:
((!isset($_GET["cPath"]) means the same things as
$_GET["cPath"]=="") because !isset (variable not set) means the same thing as "" (variable equals and empty string)
ASKER
and a fine lesson that is. Extremely helpful.
isset($_GET["cPath"]) == whethere the Field present in Get method
then OR means
$_GET["cPath"]=="" if present then is it null ?
If both are True the
AND that is &&
isset($_GET["keywords"]) whethere the Field present in Get method