Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with validation of a drop down menu

    Is there a way to validate a word drop dowm menu.
    I one that has the following options. SELECT- Freshman- Sophomore-Junior-Senior.

    THe default one showing is SELECT and I want my form to tell the user if she forgot to make a selection here is my code

    [code]
    if($Class=='SELECT')
    {echo'<b>You forgot to enter your Class &nbsp &nbsp Press the Back Button <br/>';$dataOK = FALSE;}

  • #2
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,547
    Thanks
    57
    Thanked 148 Times in 147 Posts
    PHP Code:
    <?php
    if($Class=="SELECT")
    {
        echo 
    "<b>You forgot to enter your Class &nbsp &nbsp Press the Back Button <br/>";
        
    $dataOK FALSE;
    }
    ?>

    <select name="Class">
        <option>SELECT</option>
        <option>sdfsds</option>
        <option>sdfsds</option>
        <option>sdfsds</option>
        <option>sdfsds</option>
    </select>
    should be ok. You should google "header(location: );" as using php we dont need to tell people to press the back button, you can make em!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •