#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Sacramento
    Posts
    50
    Rep Power
    14
    Hi,

    I have this input box that is optional called "Reason"

    If a user submits this form with data in the "Reason" form then I want to take those contents and add to them, ie:

    if (isset($reason)) {

    $reason_message = "Reason for rejection: $reason";

    }

    else {

    $reason_message = "";

    }


    Then I have $reason_message sent alow with other stuff in an email. The problem is that if a user leaves "Reason" empty, when they get their email, this string called "Reason for rejection:" is sent.

    Bottom line: is there a way for me to tell that "Reason" has no value and there for not send "Reason for rejection:"

    Hope this makes sense. Thank you very much!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    58
    Rep Power
    14
    Always a tricky one.

    if (isset($reason)) {
    means: is reason a variable that can be used, manipulated?

    if ($reason != '') {
    means: is reason NOT empty?
    This returns false if reason doesn't exist.

    ------------------

    peterbe.com

Similar Threads

  1. Replies: 4
    Last Post: February 13th, 2004, 03:31 PM
  2. A variable $_POST variable?
    By CLuver in forum PHP Development
    Replies: 0
    Last Post: February 11th, 2004, 12:55 AM
  3. variable variables problem
    By gbow in forum PHP Development
    Replies: 5
    Last Post: February 10th, 2004, 10:04 AM
  4. How to read multiple line text file into a variable
    By gatewaycityca in forum Visual Basic Programming
    Replies: 4
    Last Post: January 29th, 2004, 12:26 PM
  5. Do compilers optimize some / into *?
    By Jason Doucette in forum C Programming
    Replies: 46
    Last Post: December 25th, 2003, 08:47 PM

IMN logo majestic logo threadwatch logo seochat tools logo