|
|
| Code Error |
Expert:Venkat
How to insert checkbox values to mysql using php |
| Answers |
Hi friend,
Code to help in solving the problem :
<?php if($_POST['check']!="") { $check = $_POST['check']; $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db("my_db", $con);
mysql_query("INSERT INTO Persons (checkvalue) VALUES ($check)");
mysql_close($con); } ?>
<HTML> <HEAD> <TITLE>Insert CheckBox</TITLE> </HEAD>
<BODY> <form name="checkForm" method="post"> <input type="checkbox" name="check" value="Roseindia">
<input type="submit" name="Submit" value="Insert"> </form>
</form> </BODY> </HTML>
Thanks
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|