how to add multiple checkbox in phpmyadmin using set or enum…
here is the code its not working for multiple selection and unable to show in database table…
help…
<?php
error_reporting(0);
$submit = $_POST['submit'];
$username= $_POST['username'];
$ename = strip_tags($_POST['ename']);
$date = date("y-m-d");
session_start();
if($submit)
{
$connect = mysql_connect("localhost","root","") or die("Couldn't connect!");
mysql_select_db("ttlogin") or die("Couldn't find db");
$query = "SELECT username FROM users WHERE username='$username' AND password=SHA('$password')";
$result = @mysql_query($query); // Run the query.
$result = mysql_num_rows($query);
if ($result!=0)
{
die("Username already exists");
}
else
$row = mysql_fetch_array ($result, MYSQL_NUM);
if($row)
{
$_SESSION['id'] = $row[0];
$_SESSION['username'] = $row[1];
ob_end_clean();
}
mysql_query("INSERT INTO events(username,ename,date) VALUES('".$_SESSION ['username']."','$ename','$date')");
die("you have been registered!
Return");
}
?>
confirm
Checkboxes
<?PHP
$ch1 = 'unchecked';
$ch2 = 'unchecked';
$ch3 = 'unchecked';
if (isset($_POST[‘Submit1’])) {
if (isset($_POST[‘ch1’])) {
$ch1 = $_POST[‘ch1’];
if ($ch1 == ‘paper presentation’) {
$ch1 = ‘checked’;
}
}
if (isset($_POST[‘ch2’])) {
$ch2 = $_POST[‘ch2’];
if ($ch2 == ‘tech quiz’) {
$ch2 = ‘checked’;
}
}
if (isset($_POST[‘ch3’])) {
$ch3 = $_POST[‘ch3’];
if ($ch3 == ‘collage’) {
$ch3 = ‘checked’;
}
}
}
?>
<Input type = ‘Checkbox’ Name =‘ch1’ value =“paper presentation”
<?PHP print $ch1; ?>
Paper Presentation
>Tech Quiz
>Collage