Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Specify Input Values for Checkboxes
How To Specify Input Values for Checkboxes? - PHP Script Tips - Processing Web Forms
✍: 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.
2007-04-23, 5112👍, 0💬
Popular Posts:
How To Get the Minimum or Maximum Value of an Array? - PHP Script Tips - PHP Built-in Functions for ...
What Is the Data Pump Import Utility? - Oracle DBA FAQ - Loading and Exporting Data Oracle Data Pump...
How To Call a Sub Procedure? - Oracle DBA FAQ - Creating Your Own PL/SQL Procedures and Functions To...
How To Set Up Breakpoints in Debug Mode? - Oracle DBA FAQ - Introduction to Oracle SQL Developer To ...
Where Is the Submitted Form Data Stored? - PHP Script Tips - Processing Web Forms When a user submit...