Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To 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 August 5th, 2003, 01:33 PM
Authorized User
 
Join Date: Aug 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Checkbox input won't email

Hello all. I am collecting information via an HTML form that includes checkboxes which posts to a PHP file. An email is then sent to the information collector. All of the text and radio inputs email properly, but the checkboxes stop the page loading and emailing cold, and all I get is a blank page. It's probably something so dreadfully simple. Maybe I just need another pair of eyes seeing my mistake. Any help would be greatfully accepted. Thanks!

Partial HTML Form Code:
Code:
<p>License #:<br>
  <input type="text" name="license_no" maxlength="200" size="50"></p>
<p>VIN #:<span class="red">*</span><br>
  <input type="text" name="vin" maxlength="200" size="50"></p>
<p>Please check all that apply:<br>
  <input type="checkbox" name="2door" value="2-door">&nbsp;2-Door<br>
  <input type="checkbox" name="4door" value="4-door">&nbsp;4-Door<br>
  <input type="checkbox" name="stationwagon" value="stationwagon">&nbsp;Station wagon<br>
  <input type="checkbox" name="4wheeldrive" value="4-wheel drive">&nbsp;4-wheel drive</p>
Partial Email Code:
Code:
$mail_to = "[email protected]";
$mail_subject = "Email Information";
$mail_body = "License #: ".$license_no."\n";
$mail_body .= "VIN #: ".$vin."\n";
$mail_body .= "2-Door? ".$2door."\n";
$mail_body .= "4-Door? ".$4door."\n";
$mail_body .= "Station wagon? ".$stationwagon."\n";
$mail_body .= "4-wheel drive? ".$4wheeldrive."\n";
$mail_from = "From: ".$email."\nReply-To: ".$mail_from;

if(mail($mail_to, $mail_subject, $mail_body, $mail_from))
 echo "<p>Thank you. You should be contacted within three or four business days at the most.</p>";
else echo "<p>Failed to send the e-mail \"$mail_subject\".</p>";
__________________
HollyAnn
aka Scottiegirl

\"I was put on Earth to accomplish a certain number of things. Right now I am so far behind, I will never die.\" - Calvin, Calvin and Hobbs
 
Old August 5th, 2003, 03:44 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

The problem is variable names may not begin with numbers.

$4door should be $fourdoor or $four_door. And the others likewise.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old August 5th, 2003, 03:50 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

BTW:

And $_4door will work.

For your reference:
http://www.php.net/manual/en/language.variables.php



:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old August 6th, 2003, 07:40 AM
Authorized User
 
Join Date: Aug 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You know, somehow I knew that but it just didn't surface when I was coding it. Thank you SO much! :D





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access: Checkbox input to build query soglejr Access 4 January 28th, 2008 09:49 AM
checkbox balbirkumar Pro JSP 0 July 2nd, 2007 02:26 AM
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
Need Help regards checkbox nellaikumar ASP.NET 1.0 and 1.1 Basics 1 December 1st, 2005 02:07 PM
checkbox damnnono_86 Access 2 October 10th, 2003 03:25 AM





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