Jump to content

What is the difference between


BrianM

Recommended Posts

see this example....it displays null if both values are empty...
example1:
<?
if($_POST["submit"]=='submit')
{
if($_POST["text"]=="")
{
echo "null value in text";
}
if($_POST["name"]==="")
{
echo "null value in name";
}
}
?>
<form action="" method="post">
<br />
<input type="text" name="text" />
<input type="text" name="name" />
<input type="submit" name="submit" value="submit" />
</form>

example2:

<?
if($_POST["submit"]=='submit')
{
if($_POST["text"]=="")
{
echo "null value in text";
}
if($_POST["name"]==="")
{
echo "null value in name";
}
}
?>
<form action="" method="post">
<br />

<input type="text" name="name" />
<input type="submit" name="submit" value="submit" />
</form> 
it displays same result ..." null values in text null values in text"


example3:

<?
if($_POST["submit"]=='submit')
{
if($_POST["text"]=="")
{
echo "null value in text";
}
if($_POST["name"]==="")
{
echo "null value in name";
}
}
?>
<form action="" method="post">
<br />
<input type="text" name="text" />

<input type="submit" name="submit" value="submit" />
</form>

it displays only null values in text....  since "===" operator checks for values as well as occurence of text box name in the form...

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.