Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Apr 2020
    Posts
    1
    Member #
    61531

    How to use php empty function for this?

    Good morning. Below is how my php formmail script processes my spam question. Whats the simplest way to write the same type of thing but only checking for if “name, phone, and email” inputs are NOT left empty? Thanks

    So I just need to know how to write a simple if/else statement but checking for an empty field.

    HTML Code:
    if ($spam == 4){
        // success, continue processing
    }
    else{
        header( "Location: $errorurl" );
    	exit ;
    }

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,830
    Member #
    5580
    Liked
    726 times
    Use Google to search for PHP functions such as 'empty', 'isset', 'is_null()'

    Empty is fine for text strings, but not for checkboxes, so you have to be careful how it is used.

    if(empty($username)){
    // the username was not entered ... it was left blank.
    }

    If I was doing your project and didn't know PHP very well, I might find an existing secure PHP/AJAX form script that is already written and proven.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:10 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com