Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: Handling Checkboxes
02-20-2010, 02:25 AM #1
- Join Date
- Jan 2010
- Thanked 10 Times in 10 Posts
Ok, so I looked up this up a bunch of places, but none of them could really solve my issue, which is suprising, because it seems pretty simple...
I have a very basic ajax email form, and I just can't figure out how to handle the checkboxes in it. It would be great if I could have the email send the values of the checkboxes if they are checked (for example, if there were checkboxes 1,2, and 3, if only 3 were checked, the email would display "boxes checked: 3"), but if not, it's not a disaster to have each box even displaying a true or false value.
Here's my PHP, and here's and example of the page... I hope someone can help me with this?
<?php //declare variables $name = $_GET['name']; $title = $_GET['title']; $company = $_GET['company']; $address1 = $_GET['address1']; $address2 = $_GET['address2']; $city = $_GET['city']; $state = $_GET['state']; $email = $_GET['email']; $telephone = $_GET['telephone']; $fax = $_GET['fax']; $dial = $_GET['dial']; $auto = $_GET['auto']; $comptel = $_GET['comptel']; $other = $_GET['other']; $overall1=($_GET['a1'])?"Yes":"No"; $app=($_GET['a2'])?"Yes":" No"; $overall2=($_GET['a3'])?"Yes":"No"; $see = $_GET['purchase']; $list = $_GET['MailingList']; $subject = "Demo Request from Website!"; $message = " Contact Information: \r \n Name: $name \r \n Title: $title \r \n Company: $company \r \n Address: \r \n $address1 \r \n $address2 \r \n Location: $city , $state \r \n Email: $email \r \n Phone Number: $telephone \r \n Fax: $fax \r \n \r \n Interested in... \r \n Predictive Dialer? = $dial \r \n Auto Dialer? = $auto \r \n Computer Telephony? = $comptel \r \n Other: $other \r \n \r \n This person wants to see: \r \n Overall1: $overall1 \r \n Overall2: $overall2 \r \n App: $app \r \n This person needs a solution: $purchase \r \n \r \n Add to the mailing list? $mailinglist"; mail("firstname.lastname@example.org", $subject, $message); ?> <h5><span>Thank You,<h10> <?php echo $name ?>!</h10></span></h5> <p class="heading2"><span>Your message will be answered as soon as possible.</span></p>