|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Form Tutorial - Check Box Problem
Hi I just took the codewalker tutorial to make forms. Good Stuff.
I ran into two problems: 1)If none of the check boxes are chosen...the php reports an error. Warning: Invalid argument supplied for foreach() in /var/virtual_www/earthpoint.net/formtest/formy2.php on line 24 And I do not want to require that a check box has to be chosen. 2) I pasted in the code I had prevous to the tutorial, that I used for sending the report to my email........but I am missing something on how to code multiple checkboxes to pass info on to email. It reports for the checkboxes only "Array" beside the checkbox field in the email report. Here is the html where I posted: http://www.earthpoint.net/formtest/formy2.html And here is the php I used: I'll be grateful for any tips, Steven <HTML> <HEAD> <TITLE>Doing something with the form</TITLE> </HEAD> <BODY> <? $toaddress = "sbolgiano@expoengineer.net"; $subject = "Test Forms"; $mailcontent = "mytextbox: ".$mytextbox."n" ."mycheckbox1:".$value."n" ."myselectbox: ".$myselectbox."n" ."myradio: ".$myradio."n" ."mytextarea: ".$mytextarea."n" ; mail($toaddress, $subject, $mailcontent); if(isset($_POST['mybutton'])) { echo "Great! You clicked the button!n"; echo "<BR>You typed <b>" . $_POST['mytextbox'] . "</b> in the textbox.n"; if(isset($_POST['mycheckbox'])) { echo "<BR>You checked the checkbox.n"; } else { echo "<BR>You didn't check the checkbox.n"; } foreach($_POST['mycheckbox'] as $value) { echo "<BR>You clicked checkbox number " . $value . "n"; } echo "<BR>The color you picked was " . $_POST['myradio'] . "n"; echo "<BR>" . $_POST['myselectbox'] . " was chosen from the select list.n"; echo "<BR>In the textarea, you typed: " . $_POST['mytextarea'] . "n"; } else { echo "Hmm...you must have come to this script without clicking the button.n"; } ?> </BODY> </HTML> |
![]() |
| Viewing: Codewalkers Forums > Other > Tutorials > Form Tutorial - Check Box Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|