web 2.0

How to use PHP & Checkbox

How to use PHP &  Checkbox This tutorial how to using PHP read a variable from checkbox

ShotDev Focus:
- Using PHP & Checkbox

Example

php_checkbox1.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form action="php_checkbox2.php" method="post" name="form1">
Please select color.<br>
<input type="checkbox" name="chkColor1" value="Red">Red<br>
<input type="checkbox" name="chkColor2" value="Blue">Blue<br>
<input type="checkbox" name="chkColor3" value="Green">Green<br>
<input name="btnSubmit" type="submit" value="Submit">
</form>
</body>
</html>

php_checkbox2.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
echo $_POST["chkColor1"]."<br>";
echo $_POST["chkColor2"]."<br>";
echo $_POST["chkColor3"]."<br>";
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_checkbox1.php

Screenshot

PHP Checkbox

PHP Checkbox
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.