SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot arthaus's Avatar
    Join Date
    Jun 2002
    Location
    Pasadena, CA
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HELP: checked [checkbox] will email

    Hi,

    Currently I have a form that will email once page is visited.

    Q: How can I make it if a checkbox is checked? ...if not checked, email is not sent!

    Code:
    <p><input tabindex="87" type="checkbox" title="Need Help: Please call me!" name="svc[]" id="svc[]" value="helpme"><label for="svc[]"> I need help with this form.</label> <strong>Please call me!</strong></p>
    PHP Code:
    <?php  
        $to 
    "service@servicelab.com";
        
    $subject "HELP: eBid Request Form II ($count)";

        
    $sentemail "From: $contact
            
    $choices";
        
    $headers "From: $email <> \n";
        
    $headers .= "Reply-To: $email\n\n";

            if (
    mail($to$subject$sentemail$headers)) {
                echo (
    "<center>Your email has been successfully sent!</center>\n");
                    } else {
                echo (
    "<center>Your email was NOT successfully sent due to a system error!</center>\n");
            }
    ?>
    Thankx in advance,
    Arthur

  2. #2
    pie??? PIE!!!! rsdl's Avatar
    Join Date
    May 2001
    Location
    Vancouver, BC Canada
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can do it like so:

    // in the html page
    <input type='checkbox' name='contact' value='contact'>

    // on the php page
    PHP Code:
    $checkbox $_POST['contact'];
    if (isset(
    $checkbox)) {
    // mail stuff here
    }
    else {
    //blah

    i hope this helps

    -rsdl

  3. #3
    SitePoint Zealot arthaus's Avatar
    Join Date
    Jun 2002
    Location
    Pasadena, CA
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi rsdl,

    Thankx...you "saved my bacon" again!!

    I appreciate your help,
    Arthur


Bookmarks

Posting Permissions

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