0

Ok so i'm trying to validate my input string for location however its working if input is empty but i'm trying to validate the input for 'Greenwich' but that isn't working. Can anyone see what is wrong with my code:

<div class="elements">
      <label for="location">Location:</label>
      <input type="text" id="location" name="location" size="25" />
      <?php

         if (isset($_POST['formsubmitted'])) {






        if(!isset($_REQUEST['location']) || empty($_REQUEST['location'])) {    

echo "<font color='red'>Please enter location</font>";
}

else

{
if(!isset($_REQUEST['location']) || ($_REQUEST['location']) == "Greenwich")  
{
echo "<font color='red'>Location must be greenwich</font>";
}


}}
?>
    </div>

    <div class="elements">
      <label for="information">Information:</label>
      <textarea rows="4" cols="20" name="information" >
2
Contributors
1
Reply
15
Views
4 Years
Discussion Span
Last Post by tiggsy
0

you want greenwich? then the test is
if(!isset($_REQUEST['location']) || ($_REQUEST['location']) != "Greenwich")
atm, it will reject if empty, or if equal to Greenwich.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.