I have found a strange situation in php...or maybe I don't remember something well:
<?php
if (isset($_POST["invio"]) && ($_POST["valore1"] && $_POST["valore2"])) {
if($_POST["valore1"]) {
$valore1 = $_POST["valore1"];
}
if($_POST["valore2"]) {
$valore2 = $_POST["valore2"];
}
function pippo ($x,$y) {
if($x < $y) {
return "la variabile $x è minore della variabile $y";
}
elseif($x == $y) {
return "la variabile $x è uguale alla variabile $y";
}
else {
return "la variabile $x è più grande rispetto alla variabile $y";
}
}
$risultato = pippo($valore1,$valore2);
print $risultato;
}elseif (isset($_POST["invio"]) && ($_POST["valore1"] =="" || $_POST["valore2"] =="") ) {
print "Manca almeno un valore";
}
If I try to delete the two parentheses:
}elseif (isset($_POST["invio"]) && $_POST["valore1"] =="" || $_POST["valore2"] =="" ) {
print "Manca almeno un valore";
}
The system enters inside the condition with the print.. why does it do this?