Wrox Programmer Forums
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 1st, 2007, 06:39 PM
Registered User
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP checkboxes with mail(); for each value

Hi, I am creating a form with checkboxes. I have no problem getting the values to return in the handle_event.php page and via email. My client wants the each property manager to receive an email when their property is "checked":

print '<form action="handle_event.php" method="post"></p>';
    print '<table width="800px" id="maincontent">


<input type="checkbox" name="condo[]" value="<a href=http://www.berkmanplaza.com>Berkman Plaza 2</a>" />Berkman Plaza 2<br /><br />
 <input type="checkbox" name="condo[]" value="<a href=http://www.thechelsealofts.com>Chelsea Lofts</a>" />Chelsea Lofts<br /><br />
 <input type="checkbox" name="condo[]" value="<a href=http://www.cityplacejacksonville.com>City Place</a>" />City Place<br /><br />

<tr><td><input type="submit" name="submit" value="Register" /><input type="reset" name="reset" value="Reset" /><br><br><br>
I'm successful with the user receiving an email with their choices, and I'm successful with the CC and BCC parameters - no errors. What I really need to do is somehow apply the mail(); to each property or "value". If Berkman Plaza is checked, then someone at Berkman Plaza would automatically receive an email, and so on..

Many thanks if anyone could help!

Old November 2nd, 2007, 01:47 PM
Authorized User
Join Date: Sep 2007
Posts: 56
Thanks: 0
Thanked 1 Time in 1 Post

Add on to your value property for each checkbox.
Try adding the email as the first property and leave the link as the second and split them by a certain string such as ^^

As an example the first checkbox might become

<input type="checkbox" name="condo[]" value="[email protected]^^<a href=http://www.berkmanplaza.com>Berkman Plaza 2</a>" />Berkman Plaza 2<br /><br />
To get the values you would explode the value of the checkbox inside your loop
$values = explode("^^",checkbox[$loopCounterVariable]);
$emailto = $values[0];
$url = $values[1];

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
sending mail through php rkzico PHP How-To 1 November 8th, 2007 10:03 AM
flash php mail xeno Flash (all versions) 1 July 9th, 2005 04:45 PM
php mail() problems Morrislgn Beginning PHP 1 August 9th, 2004 03:55 PM
php mail() problem saicon Beginning PHP 2 August 18th, 2003 12:39 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.