Hello, I have two codes that appear identical to me in the if statements, yet one does exactly what i want it to do and the other one keeps going to the else could someone help me see why it is doing what its doing
This is the code 1 that works:
<?php
//will test if the values are set
if(isset($_POST['submitted'])){
if(isset($_POST['name']) && isset($_POST['tel']) && isset($_POST['email'])){
if(is_numeric($_POST['tel'])){
}
else{
echo"<div class=\"error1\">Error!</div>";
}
}
else{
echo"not all fields ware complete";
}
}
else{
echo"COMPLETION STATUS: IN PROGRESS";
}
?>
<h1>Contact Us</h1>
<div class="subtitle">Enter Your Information Below</div>
<form method="post" action="practicecon.php">
Name: <br/><input type="text" name="name"/></p>
Telephone Number: <br/><input type="text" size="15" name="tel"/></p>
Email: <br/><input type="text" name="email" size="35"/></p>
Comment: <br/><textarea rows="10" cols="130" name="comment"></textarea></p>
<p><input type="submit" Value="Submit"></p>
<input type="hidden" name="submitted" value="1"/>
</form>
and this is the code 2 that keeps displaying the else echo"all fields required"
<?php
//will test if the values are set
if(isset($_POST['submitted'])){
if(isset($_POST['name']) && isset($_POST['tel']) && isset($_POST['email'])){
if(is_numeric($_POST['tel'])){
}
else{
echo"<div class=\"error1\">Error!</div>";
}
}
else{
echo"not all fields ware complete";
}
}
else{
echo"COMPLETION STATUS: IN PROGRESS";
}
?>
<h1>Contact Us</h1>
<div class="subtitle">Enter Your Information Below</div>
<form method="post" action="practicecon.php">
Name: <br/><input type="text" name="name"/></p>
Telephone Number: <br/><input type="text" size="15" name="tel"/></p>
Email: <br/><input type="text" name="email" size="35"/></p>
Comment: <br/><textarea rows="10" cols="130" name="comment"></textarea></p>
<p><input type="submit" Value="Submit"></p>
<input type="hidden" name="submitted" value="1"/>
</form>