[Urgent] Very Simple PHP Question

Discussion in 'PHP' started by SiteBuyerUK, Mar 7, 2007.

  1. #1
    Hey,

    I feel like an idiot asking this, but my mind has gone blank, and its very annoying.

    How do i check what a user has entered in a form against some preset values?

    I have a drop down with 5 options and i want to make sure the person is using my form by checking they have chosen one of those 5 options and not something else.

    Thanks
     
    SiteBuyerUK, Mar 7, 2007 IP
  2. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $allowed = array('one value','another value','pie','cheese');
    if ( ! in_array($_POST['selectname'],$allowed) ) {
        echo 'Not allowed';
    }
    PHP:
     
    rodney88, Mar 7, 2007 IP
    SiteBuyerUK likes this.
  3. SiteBuyerUK

    SiteBuyerUK Peon

    Messages:
    253
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, its all come rushing back :D
     
    SiteBuyerUK, Mar 7, 2007 IP