Example one (post submission form):
Copy CodeThe code is as follows:
<title><br>chunkify Form <BR></title>
Copy CodeThe code is as follows:
<title><br>chunkify Word <BR></title>
$word =$_post[' word '];
$number =$_post[' number '];
$chunks =ceil (strlen ($word)/$number);
echo "The $number-letter chunks of ' $word ' are:
\ n ";
for ($i = 0; $i < $chunks; $i + +) {
$chunk =substr ($word, $i * $number, $number);
printf ("%d:%s
\ n ", $i +1, $chunk);
}
?>
HTML Displays the page.
The page to be processed by PHP after the form is submitted. In this example, I enter a word and then, given a length, divide the word into chunks of that length.
Demonstrates submitting a form through the post method.
Example two (single radio, get accept form):
Copy CodeThe code is as follows:
if (array_key_exists (' s ', $_get)) {
$des = Implode (' ', $_get[' att ');
echo "You have a $des personality.";
}
?>
Example three (multi-select, get accept form):
Notice that at this pointUnderline tells get that you are transmitting the array, the bold part is to change the selection box to a multi boxCopy CodeThe code is as follows: if (array_key_exists (' s ', $_get)) {$des = Implode (' ', $_get[' att ');echo "You have a $des personality.";}?> Example Four (check box checkbox): The same name= "att[" is to tell get you are transmitting an array, checked means that the option is the initial default selection, the same example, adding Selected= "selected" in the tag can alsoMake multiple selections the initial default selection.Copy CodeThe code is as follows: if (array_key_exists (' s ', $_get)) {echo "";Print_r ($_get);echo "";if (Is_null ($_get[' att])) exit;$des = Implode (' ', $_get[' att ');echo "You have a $des personality.";}?> Example five (single box): Note that the same option can be a single selection must be name equalCopy CodeThe code is as follows: When a user taps a radio button, the button becomes selected and all other buttons become unchecked. Example six (stick form): How a table is to be implemented before the values entered are still present after the page is refreshed can be as followsCopy CodeThe code is as follows: $f = $_post[' fa '];?> if (!is_null ($f)) {$c = ($f-32) *5/9;printf ("%.2lf is%.2LFC", $f, $c);}?> Are some simple form processing ~Knowledge Make me stronger!Http://www.bkjia.com/PHPjc/323405.htmlWww.bkjia.comTrueHttp://www.bkjia.com/PHPjc/323405.htmlTecharticleExample one (POST submission form): Copy the Code code as follows: HTML head title chunkify Form/title/head body Form action= "chunkify.php" method= "POST" Enter A Word:input type= "Text ...