Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

php contact forms and post variable

Options
  • 02-05-2011 4:45pm
    #1
    Closed Accounts Posts: 19,080 ✭✭✭✭


    so i have www.test.com/file.php

    in this file.php i have some variables which are name, address and email.

    i call this file.php from an application which uses the server to send an email with various details.

    i would like to prevent this file sending a blank email when i goto www.test.com/file.php without putting any variables in.

    i have tried checking empty, "", etc on the post variables but i'm having no success.

    can you recommend a way to check if a post variable is set or empty so that i can add in an if/else?

    thanks


Comments

  • Closed Accounts Posts: 4,001 ✭✭✭Mr. Loverman


    !isset
    ""
    null

    Maybe show us your code so we can see if you are doing something funny.


  • Registered Users Posts: 437 ✭✭t1mm


    if (isset($_POST['email']) && isset($_POST['name']) && isset($_POST['address'])){
         //send email
    }
    else {
          echo("One or more inputs were not supplied.");
    }
    

    Replace POST with GET depending on how the data is being sent.


Advertisement