Beginner Question

    Date: 12/06/05 (PHP Community)    Keywords: html, web

    First post here, I've done a fir bit of research into this and still can't work it out.

    I have a form that has a checkbox. What need to happen is that if the box is checked then it needs to redirect to a website and send a mail stating that they person has checked the ticlbox, if not it needs to just send the mail stating that the box has not been checked . The mailing part is fine (I think) it's just the issue with the redirection. I can't seem to get my head around it. I know I should be using the $variable = ( condition ? "value if condition is true" : "value if condition is false" ); string but I'm at a loss of how to do it.

    Basically what the rediection needs to do is what the form below does.


    https://www.paypal.com/cgi-bin/webscr" method="post">





    http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">


    So by ticking the tickybox the mail gets sent with it saying that they've payed via paypal and redirects to the site with the above values intact.

    Head-Desk-Head-Desk-Head-Desk-Head-Desk-Head-Desk

    Anyone help?

    [Edit]

    My mailing script looks somewhat like this atm and works apart from the checkbox.


    $name = $_POST['name'];
    $socname = $_POST['socname'];
    $dob = $_POST['dob'];
    $email = $_POST['email'];
    $telhome = $_POST['telhome'];
    $telwork = $_POST['telwork'];
    $telmob = $_POST['telmob'];
    $add1 = $_POST['add1'];
    $add2 = $_POST['add2'];
    $town = $_POST['town'];
    $postcode = $_POST['postcode'];
    $membership = $_POST['membership'];
    /*if ($_POST["membership"] != "")
    {
    header ("Location: https://www.paypal.com/cgi-bin/webscr" . $_POST["item_name"]);
    }*/
    $to = "xxx@darknetweb.co.uk";
    $re = "Membership Application";
    $msg = "Name: $name
    ";
    $msg .= "Society Name: $socname
    ";
    $msg .= "Date of Birth: $dob
    ";
    $msg .= "E-Mail: $email";
    $msg .= "

    Home Telephone: $telhome
    ";
    $msg .= "Work Telephone: $telwork
    ";
    $msg .= "Mobile Telephone: $telmob";
    $msg .= "

    Address 1: $add1
    ";
    $msg .= "Address 2: $add2
    ";
    $msg .= "Town: $town
    ";
    $msg .= "Postcode: $postcode
    ";
    $msg .= "

    Membership Payed: $membership";
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html;";
    $headers .= " charset=iso-8859-1\r\n";
    $headers .= "From: $email \r\n";
    mail ( $to, $re, $msg, $headers );


    The commented out section is the start of the redirection. I'm still unsure of how to output a True or False value for the checkbox though.

    Source: http://www.livejournal.com/community/php/374611.html

« Nifty bit of code I thought... || When you think you know... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home