Deal with Array Form Data : Form Data « Form « PHP






Deal with Array Form Data


<HTML>
<BODY>
<FORM METHOD="POST" ACTION="DealWithArrayFormData.php">
<H1>Contact Information</H1>
<TABLE>
<TR>
  <TD>Childrens' Names:</TD>
</TR>
<TR>
  <TD><INPUT TYPE="TEXT" NAME="children[]"></TD>
</TR>
<TR>
  <TD><INPUT TYPE="TEXT" NAME="children[]"></TD>
</TR>
<TR>
  <TD><INPUT TYPE="TEXT" NAME="children[]"></TD>
</TR>
<TR>
  <TD><INPUT TYPE="TEXT" NAME="children[]"></TD>
</TR>
<TR>
  <TD><INPUT TYPE="TEXT" NAME="children[]"></TD>
</TR>
</TABLE>
<BR>
<BR>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<BR>
<BR>
<INPUT TYPE="RESET"  VALUE="Clear the Form">
</FORM>
</BODY>
</HTML>

<!-- DealWithArrayFormData.php

<?php
foreach ($children as $index => $child){
    echo "<BR>child[$index]=$child";
}
echo "<BR>";

sort($children);

foreach ($children as $index => $child){
    echo "<BR>child[$index]=$child";
}
?>
-->
           
       








Related examples in the same category

1.A process_form() Function
2.Access widget's form value
3.Accessing multiple submitted values
4.Calculation based on form data
5.Forms and PHP
6.Feedback Form
7.Handling Special Characters
8.multivalue-forms.php
9.Saying "Hello"