Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts

    with this the checkbox['emailme'] must have default UNCHECKED or does not matter ?

    In PHP code
    if (isset($_POST['emailme'])) {

    with this to work, in html the checkbox['emailme'] must have default UNCHECKED or does not matter ?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,519
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    I believe that is correct. If a checkbox is "unchecked", it is actually null or not defined.

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    That way is just fine, though you could also do something like
    PHP Code:
    if ( array_key_exists('emailme'$_POST) ){ 
    Just for informational purposes...
    If I'm postin here, I NEED YOUR HELP!!

  • #4
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what is the best [with unchecked checkbox] ?
    --------------------------------------------
    if (isset($_POST['emailme'])) {
    mail($email,$subject,$message_customer,$headers);
    $_SESSION['m'] = "An email message has been sent!" ;
    } else {
    $_SESSION['m'] = "No" ;
    }
    --------------------------------------------
    $_SESSION['m'] = "No" ;
    if (isset($_POST['emailme'])) {
    mail($email,$subject,$message_customer,$headers);
    $_SESSION['m'] = "An email message has been sent!" ;
    }
    I try first but work fine the only thing $_SESSION['m'] do not print NO or YES to confirm page , this is a session problem ?
    I use:
    <?php
    session_start(); // start up your PHP session!
    ?>.................................................................................................. ...........
    <tr>
    <td><div align="right" class="formfieldslabels">Send A Copy Of
    This Request To Me: </div></td>
    <td><div align="left" class="formfields">
    <?php
    echo $_SESSION['m'];
    unset($_SESSION['m']); ?>
    </div></td>
    </tr>

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,519
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    You can't set sessions and assign variables and use them all
    in the same "instance" of a script. By that, I mean it takes at
    least one refresh to set or change the session variable ... that's
    because it happens in the Header (like a cookie).

    Create a separate script called "sessions.php" where you do
    all of your session stuff, then it redirects back using:
    header("Location: emailscript.php"); (or whatever your script is called).

    That separate script does not need to "echo" anything, it just needs to
    create, modify, or delete session variables and redirect back. It's operation
    is invisible to the user.

  • #6
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is this required ? please note that
    processorform.php sets session var:
    if (isset($_POST['emailme'])) {
    mail($email,$subject,$message_customer,$headers);
    $_SESSION['m'] = "An email message has been sent!" ;
    } else {
    $_SESSION['m'] = "No" ;
    }
    and confirmandemail.php echo/unset session var:
    <?php
    session_start(); // start up your PHP session!
    ?>................................................................................................. . ...........
    <tr>
    <td><div align="right" class="formfieldslabels">Send A Copy Of
    This Request To Me: </div></td>
    <td><div align="left" class="formfields">
    <?php
    echo $_SESSION['m'];
    unset($_SESSION['m']); ?>
    </div></td>
    </tr>
    well is needed any action, that you refer ?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •