• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Friday, July 27, 2012

CHECKBOX IN PHP


Hi… welcome again in my page… in here you want geetting many knowledge….

Now.. I want giving you knowledge about PHP and discuss about “CHECK BOX IN PHP”. You know that..? If you do noy know.. Let’s reading my article… Let’s check it…

In PHP to be found many FORM. And the FORM like as :
  • checkbox
  • Radio
  • Text
  • Submit
  • Reset
  • Password

In page I want giving you tutorial about SUBMIT and CHECKBOX in PHP.

Form checkbox is form which allows we can choice more than 1 (one) options.. Not likely type radio, we just can choice one from many options.. therefore this form type usually using for election more than 1 (one) option.

Example 1 :
you can copy this coding

<html>
<head> We Are Knowledge <br> <br>
<title> FORM IN PHP </title>
</head>
<body>
<form method = "POST" action = "wak.php">
<p align = center> Choice foods that you like <br> <br>
<table border = "3" cellspacing = "1" cellpadding = "1" align = "center">
<tr>
<td>
<input type = checkbox name = "say[]" value = "NASI GORENG">NASI GORENG <br>
<input type = checkbox name = "say[]" value = "NASI UDUK">NASI UDUK <br>
<input type = checkbox name = "say[]" value = "NASI RAMES">NASI RAMES <br>
<input type = checkbox name = "say[]" value = "NASI KEBULI">NASI KEBULI <br>
<input type = checkbox name = "say[]" value = "NASI PADANG">NASI PADANG
</td>
</tr>
<tr>
<td>
<input type = submit value = "CHOiCE">
</tr>
</table>
</body>
</html>

Next.. paste in your notepad..
Save with save as type = “HTML”..

If it is.. you must making file.php

You can copy this coding and paste in your notepad…

<?php
$a = count($_POST['say']);
for($x=0; $x<=$a - 1 ; $x++)
{
echo " food that you choose ", $_POST['say'][$x]."<br>";
}
?>

If it is you must save with save as type = “wak.php”.

And result is
We Are Knowledge


Top of Form
Choice foods that you like 
NASI GORENG
NASI UDUK
NASI RAMES
NASI KEBULI
NASI PADANG
Bottom of Form


If you choice nasi goreng nasi uduk nasi padang… to appear…

food that you choose NASI GORENG
food that you choose NASI UDUK
food that you choose NASI PADANG


Ok.. just it..
thanks for you…
don’t forget for came back….
See you later

No comments:

Post a Comment