Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

php contact forms and post variable

  • 02-05-2011 03: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