Tools, FAQ, Tutorials:
Specifying Input Values for Checkboxes in PHP
How To Specify Input Values for Checkboxes in PHP?
✍: FYIcenter.com
Checkboxes can be used in a form for two situations:
The sample PHP script page below is a modified version of submit_comments.php that has one group of multiple checkboxes and single switch:
<?php print("<html><form action=processing_forms.php method=post>"); print("<table><tr><td colspan=2>Please enter and submit your" ." comments about FYICenter.com:</td></tr>"); print("<tr><td>Your Name:</td>" ."<td><input type=text name=name></td></tr>\n"); print("<tr><td>Site Visited:</td><td>" ."<input type=checkbox name=site value=dev>Dev FYI Center " ."<input type=checkbox name=site value=sqa>SQA FYI Center " ."<input type=checkbox name=site value=dba>DBA FYI Center " ."</td></tr>\n"); print("<tr><td>Like Site:</td>" ."<td><input type=checkbox name=rate></td></tr>\n"); print("<tr><td>Comments:</td>" ."<td><input type=text name=comment></td></tr>\n"); print("<tr><td colspan=2><input type=submit><td></tr></table>\n"); print("</form></html>\n"); ?>
If you submit the form with this page, you will get something like this:
Number of values: 4 name = Peter site = dba rate = on comment = All good sites
But there is a problem with script in processing_forms.php. It picks up only one of the input values selected from the checkbox group. See the next tip for solutions.
⇒ Retrieving Input Values from Checkboxes in PHP
2016-11-13, 1526🔥, 0💬
Popular Posts:
How to add request URL Template Parameters to my Azure API operation 2017 version to make it more us...
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...
How to access Query String parameters from "context.Request.Url.Que ry"object in Azure API Policy? Q...
How To Pad an Array with the Same Value Multiple Times in PHP? If you want to add the same value mul...
How to use "json-to-xml" Azure API Policy Statement? The "json-to-xml" Policy Statement allows you t...