vendredi 27 octobre 2017

How can I can I reference number 1, 2, or 3 in my echo statement to say "First number is not numeric! Please enter a numeric value for number 1"?

Do I need to reference my form?

<form action="form1.php" method="POST">
<fieldset>
<legend>Please input numeric value in each of three text boxes below:
</legend>
<p><label for="number">number 1: <input type="text" name="number" size="9">
</label></p><br>
<p><label for="number">number 2: <input type="text" name="number2" size="9">
</label></p><br>
<p><label for="number">number 3: <input type="text" name="number3" size="9">
</label></p><br>
</fieldset>
<div id="center"><input type="submit" value="Submit"></div>
</form>

I want be able to have my echo statement state that I am missing a number from one of my textboxes

if(empty($_POST['number']) || empty($_POST['number2']) || 
empty($_POST['number3'])){
        echo "You forgot to values for all three textboxes";
    } else { if(!is_numeric($_POST['number']) || 
is_numeric($_POST['number2']) || is_numeric($_POST['number3'])){
        echo "First number is not numeric! Please enter a numeric value for 
number 1";
        }
    }

Aucun commentaire:

Enregistrer un commentaire