www.webdeveloper.com
Results 1 to 2 of 2

Thread: post check with 2 posibilities

  1. #1
    Join Date
    May 2010
    Posts
    24

    post check with 2 posibilities

    Hi,

    I Have the following issue.
    In my form I have a field that doesn't need to be filled, but if it does it needs to have a value that is 5 or higher.

    Currently it is being checked on a value lower then 5
    PHP Code:
    if ($_POST['value'] < 5){
    $error .= "Error melding."
    }else{
    $code .= $_POST['value'];

    I thought to fix this with a elseif statement, but this doesn't work. Probably because I do it wrong
    PHP Code:
    if ($_POST['value'] < 5){
    $error .= "Error melding."
    }elseif (!empty 
    $_POST['value']){
    $code .= $_POST['value'];
    }
    else{
    $code .= $_POST['value'];

    Any ideas?
    Thnx

  2. #2
    Join Date
    May 2010
    Posts
    24
    I got if fixed.
    For the ones that are wondering how:

    PHP Code:
    if( !isset( $_POST['value'] ) || '' === trim$_POST['value'] ) )
    {
        
    // nothing filled
    }
    elseif( 
    $_POST['value'] )
    {
        
    // Number to low
    }
    else
    {
        
    // Allright


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles