I’m creating a contact form with php. But when i run it in my xampp server i get a error message. I don’t understand why this happened. I can’t figure it out. Following is my error message.
Error Message:
Notice: Undefined index: Send in D:\Software\Installed\xampp\htdocs\Omdatech-Co\eng\resellers.php on line 91 (First Line ex: if(isset($_POST['Send']) & $_POST['Send'] == "Submit"))
Php code:
<?php
if(isset($_POST['Send']) & $_POST['Send'] == "Submit")
{
$fname = mysql_real_escape_string($_POST['fname']);
$email = mysql_real_escape_string($_POST['email']);
$conum = mysql_real_escape_string($_POST['conum']);
$country = mysql_real_escape_string($_POST['country']);
$find = mysql_real_escape_string($_POST['find']);
$msg = mysql_real_escape_string($_POST['msg']);
$err = array();
if(isset($fname) & isset($email) & isset($conum) & isset($country) & isset($find) &
isset($msg))
{
if(empty($fname) & empty($email) & empty($conum) & empty($country) & empty($find) &
empty($msg))
{
$err[] = "All field require";
}
else
{
if(empty($fname))
$err[] = "Your first name require";
}
}
else
{
if(!empty($err))
{
foreach($err as $er)
{
echo "<font color=red>$er</font><br/>";
}
}
else
{
echo "Thank you.";
}
}
}
?>
Can anyone fix that issue? Why i get this message ?
Because you’re using the bitwise operator when you need the logical operator:
Note the two
&&and not&.The logical operators short-circuit, so when
isset()returnsfalse, the following comparison isn’t evaluated. The bitwise operator attempts to compute a value, and evaluates the comparison, hence the warning.