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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

php contact forms and post variable

  • 02-05-2011 3: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, Registered Users 2 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