Computing.Net > Forums > Web Development > php checkboxes

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

php checkboxes

Reply to Message Icon

Name: BigShow
Date: December 27, 2005 at 00:09:13 Pacific
OS: xp
CPU/Ram: pentium
Comment:

Hey guys, I am going to post a partial code with my checkboxed part of my php form, I am new to php so bear with me. I cannot get this to send to me right, I get the email and everyhitng else id fine except next to the part that is suppose to tell the checked boxes it says Aray,Aray,Aray

<TABLE cellSpacing=3 cellPadding=0 width="80%" border=0>
<TR class="weak">
<TD><INPUT
name=Domain[] type=checkbox id=Domain value=yes></TD>
<TD>Domain Name Registration </TD>
<TD><INPUT id=webhosting type=checkbox value=yes
name=webhosting[]></TD>
<TD>Web Site Hosting</TD>
</TR>
<TR class="weak">
<TD><INPUT id=marketing type=checkbox
value=yes name=marketing[]></TD>
<TD>Internet Marketing</TD>
<TD><INPUT id=webdesign type=checkbox value=yes
name=webdesign[]></TD>
<TD>Web Site Design</TD>
</TR>
<TR class="weak">
<TD><INPUT id=cemail type=checkbox value=yes
name=cemail[]></TD>
<TD>Email Accounts</TD>
<TD><INPUT id=Maintenance type=checkbox value=yes
name=Maintenance[]></TD>
<TD>Web Site Maintenance</TD>
</TR>
<TR class="weak">
<TD><INPUT id=database type=checkbox value=yes
name=database[]></TD>
<TD>Database Capabilities</TD>
<TD><INPUT id=redesign type=checkbox value=yes
name=redesign[]></TD>
<TD>Web Site Redesign</TD>
</TR>
<TR class="weak">
<TD><INPUT id=logo type=checkbox value=yes
name=logo[]></TD>
<TD>Logo Design</TD>
<TD><INPUT id=seo type=checkbox value=yes
name=seo[]></TD>
<TD>Search Engine Optimization </TD>



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: December 27, 2005 at 12:48:26 Pacific
Reply:

The is no such thing as a PHP checkbox, PHP is just used to "create" the HTML.

Looking at what you have above, why do all the names of the fields have brackets "[]" after them? The other thing that is missing is the code that you are using to generate the email.

try removing the brackets first (as those are used for arrays!) and see if that works. If not, give a sample of the code that produces the email.

Michael J


0

Response Number 2
Name: BigShow
Date: December 27, 2005 at 17:36:37 Pacific
Reply:

Michael, here is the php code to send it to my email. Everything comes ok except the checkbox which like i said before comes back as Aray,Aray,Aray

<?
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}
$webhosting=$_POST['webhosting'];
checkOK($webhosting);
$marketing=$_POST['marketing'];
checkOK($marketing);
$webdesign=$_POST['webdesign'];
checkOK($webdesign);
$cemail=$_POST['cemail'];
checkOK($cemail);
$Maintenance=$_POST['Maintenance'];
checkOK($Maintenance);
$database=$_POST['database'];
checkOK($database);
$redesign=$_POST['redesign'];
checkOK($redesign);
$logo=$_POST['logo'];
checkOK($logo);
$seo=$_POST['seo'];
checkOK($seo);

$to="BigShow@email.com";
$message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: $email\n
Required Services:$webhosting,$marketing,$webdesign,$cemail,$Maintenance,$database,$redesign,$logo,$seo\n
Project Description:$p_description\n
Number of Pages:$numpages\n
Budget:$budget\n
Start Date:$startdate\n
Completion Date:$comp,$compyear\n
Current URL:$url\n
Contact:$contact\n";
if(mail($to,"Comments From Your Site",$message,"From: $email\n")) {
echo "Thanks for your comments.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>


0

Response Number 3
Name: BigShow
Date: December 27, 2005 at 19:00:51 Pacific
Reply:

Michael, I actually figures it out, I have to change the value from YES to what they represented. I think I was originally doing an array then changed half way through. Thanks once again for helping though.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: php checkboxes

PHP & checkboxes www.computing.net/answers/webdevel/php-amp-checkboxes/1122.html

PHP Checkboxes and Arrays www.computing.net/answers/webdevel/php-checkboxes-and-arrays/4082.html

Help with Checkboxes and array PHP www.computing.net/answers/webdevel/help-with-checkboxes-and-array-php/2568.html