lundi 31 octobre 2016

How to set form input data to equal specific strings in a PHP If Else Statement? [duplicate]

This question already has an answer here:

I'm having trouble with this for some reason. Basically i'm trying to make it so that one person can go through. If the users name is equal to "Megan" "Renae" then the output will be Hello, "Megan" "Renae" but if there is anything else I want it to output I do not know you. I know this is probably something extremely simple and it is just going over my head but if someone could help you would stop my hair from turning grey! Thank you in advance to anyone that responds.

<form method = "POST" action = " ">
<p>Please enter your first name: <input type="text" name="fName"><br>
<p>Please enter your last name: <input type="text" name="lName"><br><br>
<input type="submit" class="btnSubmit"  name="submit"></p>
</form>

<?php
if ($_POST['submit'] != "") {
if ($_POST['fName'] = "Megan") {
 if ($_POST['lName'] = "Renae") {
 echo "<p>Hello, Megan Renae</p>"; }
else {
echo "<p>I do not know you</p>";     
}}}
?>

Aucun commentaire:

Enregistrer un commentaire