Hi Frnds..
plz check below code & tell me how to create DB table,inserting values for checkboxes....
its urgent plz..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>shopping</title>




</head>

<body  class="bg">

<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td ><form name="form" action="submit.php" method="post"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFCC66">
      <tr valign="top">
        <td width="161" height="263" valign="top">
        <td width="609" align="center"><table width="100%" border="0">
          <tr>
            <td width="23%">FREE SAMPLES</td>
            <td width="27%">&nbsp;</td>
            <td width="20%">&nbsp;</td>
            <td width="30%">&nbsp;</td>
          </tr>
          <tr>
            <td>Company name : </td>
            <td><input type="text" name="cname" id="textfield" /></td>
            <td>Customer name : </td>
            <td><input type="text" name="cusname" id="textfield2" /></td>
          </tr>
          <tr>
            <td>Tel/Mobile : </td>
            <td><input type="text" name="phone" id="textfield3" /></td>
            <td>Fax number : </td>
            <td><input type="text" name="fax" id="textfield4" /></td>
          </tr>
          <tr>
            <td>Address : </td>
            <td><textarea name="address" id="textfield5" cols="21"></textarea></td>
            <td>State :</td>
            <td><input type="text" name="State" id="textfield6" /></td>
          </tr>
          <tr>
            <td>Post code :</td>
            <td><input type="text" name="post" id="textfield7" /></td>
            <td>E-Mail : </td>
            <td><input type="text" name="email" id="textfield8" /></td>
          </tr>
        </table>
          <table width="100%" border="0">
            <tr>
              <td>* please note that frieght will be charged to areas outside normal delivery routes.</br>This will be &nbsp;&nbsp;&nbsp;refunded in full should you become a customer. </td>
            </tr>
            <tr>
              <td>How did you hear about us :</td>
            </tr>
            <tr>
              <td><table width="100%" border="0">
                <tr>
                  <td width="39%">
                      <input type="checkbox" name="service[]" id="checkbox" value="See in Cafe" /> 
                      See in Cafe                  </td>
                  <td width="37%"><input type="checkbox" name="service[]" id="checkbox2" value="Referred by Friend/Employee"/> 
                    Referred by Friend/Employee</td>
                  <td width="24%"><input type="checkbox" name="service[]" id="checkbox3" value="Yellow Pages" />
                    Yellow Pages </td>
                </tr>
                <tr>
                  <td><input type="checkbox" name="service[]" id="checkbox"  value="White Pages"/>
                    White Pages</td>
                  <td><input type="checkbox" name="service[]" id="checkbox" value="YP Online" />
                    YP Online</td>
                  <td><input type="checkbox" name="service[]" id="checkbox6" value="Our Sales Rep."/>
                    Our Sales Rep.</td>
                </tr>
                <tr>
                  <td><input type="checkbox" name="service[]" id="checkbox7" value="Fine Foods/Tradeshows"/>
                    Fine Foods/Tradeshows</td>
                  <td><input type="checkbox" name="service[]" id="checkbox8" value="Through Internet" />
                    Through Internet</td>
                  <td><input type="checkbox" name="service[]" id="checkbox9" value="Other" />
                    Other</td>
                </tr>
              </table></td>
            </tr>
          </table>
          <table width="100%" border="0">
            <tr>
              <td width="39%">What type of business have you got?</td>
              <td width="37%"><input type="checkbox" name="service1[]" id="checkbox10" value="Sit down coffee shop" />
                Sit down coffee shop</td>
              <td width="24%"><input type="checkbox" name="service1[]" id="checkbox11" value="Franchise Business" />
                Franchise Business</td>
            </tr>
            <tr>
              <td><input type="checkbox" name="service1[]" id="checkbox12" value="Over the counter cafe/blosk" />
                Over the counter cafe/blosk</td>
              <td><input type="checkbox" name="service1[]" id="checkbox13"value="Restaurent"  />
                Restaurent</td>
              <td><input type="checkbox" name="service1[]" id="checkbox14" value="Other" />
                Other</td>
            </tr>
          </table>          
          <table width="100%" border="0">
            <tr>
              <td>Are you considering stocking the Laguna Range?</td>
            </tr>
            <tr>
              <td><input type="checkbox" name="service2[]" id="checkbox15" value="Yes Now?" />
                Yes Now? 
                <input type="checkbox" name="service2[]" id="checkbox16" value="With in 2 weeks"/>
                With in 2 weeks 
                <input type="checkbox" name="service2[]" id="checkbox17" value="With in 4 weeks"/>
                With in 4 weeks 
                <input type="checkbox" name="service2[]" id="checkbox18" value="More than 4 weeks"/>
                More than 4 weeks 
                <input type="checkbox" name="service2[]" id="checkbox19" value="No"/> 
                No</td>
            </tr>
            <tr>
              <td>Any particular product you are intrested in(see our Range)&nbsp; :
                <input type="text" name="product" id="textfield9" /></td>
            </tr>
            <tr>
              <td>Currently which manufacturer are you using &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
                <input type="text" name="manufacturer" id="textfield10" /></td>
            </tr>
            <tr>
              <td>Any questions or comments &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 
                <input type="text" name="comments" id="textfield11" /></td>
            </tr>
          </table>          
         
              <input type="submit" name="button" id="button" value="Submit" /> &nbsp;  &nbsp; &nbsp;
                    
              <input type="reset" name="button2" id="button2" value="Reset" />
            </td>
      </tr>

        </table>
    </form>
        </td>
        <td width="10" align="center">&nbsp;</td>
        
      </tr>
    </table></td>
  </tr>
  
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</td>
  </tr>
</body>
</html>

Thanks in advance..

Hi...
Thanks for giving reply..
Ok i know table creation..& also inserting data into table..
but i dont know about checkboxes..
thats the problem..
how to create table for checkboxes(array) in mysql..& also posting selected checkbox values..

Thanks in advance..

Hi frnds...
succesfully completed this query..
Thanks especially to Shanthi...

Attachments
<?php

$cname=$_POST['cname'];
$cusname=$_POST['cusname'];
$phone=$_POST['phone'];
$fax=$_POST['fax'];
$address=$_POST['address'];
$state=$_POST['state'];
$post=$_POST['post'];
$email=$_POST['email'];
$service=serialize($_POST['service']);
$service1=serialize($_POST['service1']);
$service2=serialize($_POST['service2']);
$product=$_POST['product'];
$manufacturer=$_POST['manufacturer'];
$comments=$_POST['comments'];



mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("kishore") or die(mysql_error());

// Create a MySQL table in the selected database
mysql_query("INSERT INTO shopping (cname,cusname,phone,fax,address,state,post,email,service,service1,service2,product,manufacturer,comments) VALUES ('$cname','$cusname','$phone','$fax','$address','$state','$post','$email','$service','$service1','$service2','$product','$manufacturer','$comments')")
 or die(mysql_error());  

echo "Inserted Succesfully!";

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>shopping</title>

<SCRIPT>//global variable for error flag
var errfound = false;
//function to validate by length
function ValidLength(item, len) {
   return (item.length >= len);
}
//function to validate an email address
function ValidEmail(item) {
   if (!ValidLength(item, 5)) return false;
   if (item.indexOf ('@', 0) == -1) return false;
   
   return true;
}
// display an error alert
function error(elem, text) {
// abort if we already found an error
   if (errfound) return;
   window.alert(text);
   elem.select();
   elem.focus();
   errfound = true;
}
// main validation function
function Validate() {
   errfound = false;
     if (!ValidLength(document.form.cname.value,1))
      error(document.form.cname,"Enter Your Company Name");
	  
	 if (!ValidLength(document.form.cusname.value,1))
      error(document.form.cusname,"Enter Your Name");
	  
	 if (!ValidLength(document.form.phone.value,1))
      error(document.form.phone,"Enter Your Phone Number");
	  
	 if (!ValidLength(document.form.fax.value,1))
      error(document.form.fax,"Enter Your fax Number");
	  
	  if (!ValidLength(document.form.address.value,1))
      error(document.form.address, "Enter Your Address");
	  
	  if (!ValidLength(document.form.state.value,1))
      error(document.form.state, "Enter Your State Name");
	  
	  if (!ValidLength(document.form.post.value,1))
      error(document.form.post, "Enter Your post");
	 
	  
	   if (!ValidEmail(document.form.email.value,1))
      error(document.form.email,"Enter Your Email Id");
     
	  
	  return !errfound; /* true if there are no errors */
}</SCRIPT> <SCRIPT language="javascript">
function Only_Num(id) {
	if(isNaN(document.getElementById(id).value)) {
		alert("Please Enter Numbers Only (0-9)..");
		document.getElementById(id).select();
		document.getElementById(id).value=""
		document.getElementById(id).focus();
	}
	return;
}
function focuson()
  { document.form.number.focus()}

function check()
	{
	if(document.form.number.value==0)
		{	
		alert("enter");	
		document.form.number.focus();
		return false;
		}
	}
</script>         


</head>

<body  class="bg">

<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td > <form name="form" action="post.php" method="post">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFCC66">
      <tr valign="top">
        <td width="161" height="263" valign="top">
        <td width="609" align="center"><table width="100%" border="0">
          <tr>
            <td width="23%">FREE SAMPLES</td>
            <td width="27%">&nbsp;</td>
            <td width="20%">&nbsp;</td>
            <td width="30%">&nbsp;</td>
          </tr>
          <tr>
            <td>Company name : </td>
            <td><input type="text" name="cname" id="textfield" /></td>
            <td>Customer name : </td>
            <td><input type="text" name="cusname" id="textfield2" /></td>
          </tr>
          <tr>
            <td>Tel/Mobile : </td>
            <td><input type="text" name="phone" id="textfield3" onChange="Javascript:LA()"  onKeyUp="Only_Num(this.id)"/></td>
            <td>Fax number : </td>
            <td><input type="text" name="fax" id="textfield4"onChange="Javascript:LA()"  onKeyUp="Only_Num(this.id)" /></td>
          </tr>
          <tr>
            <td>Address : </td>
            <td><textarea name="address" id="textfield5" cols="21"></textarea></td>
            <td>State :</td>
            <td><input type="text" name="state" id="textfield6" /></td>
          </tr>
          <tr>
            <td>Post code :</td>
            <td><input type="text" name="post" id="textfield7" /></td>
            <td>E-Mail : </td>
            <td><input type="text" name="email" id="textfield8" /></td>
          </tr>
        </table>
          <table width="100%" border="0" >
            <tr>
              <td>* please note that frieght will be charged to areas outside normal delivery routes.</br>This will be &nbsp;&nbsp;&nbsp;refunded in full should you become a customer. </td>
            </tr>
            <tr>
              <td>How did you hear about us :</td>
            </tr>
            <tr>
              <td><table width="100%" border="0">
                <tr>
                  <td width="39%">
                      <input type="checkbox" name="service[]" id="checkbox" value="See in Cafe" /> 
                      See in Cafe                  </td>
                  <td width="39%"><input type="checkbox" name="service[]" id="checkbox2" value="Referred by Friend/Employee"/> 
                    Referred by Friend/Employee</td>
                  <td width="39%"><input type="checkbox" name="service[]" id="checkbox3" value="Yellow Pages" />
                    Yellow Pages </td>
                </tr>
                <tr>
                  <td width="39%"><input type="checkbox" name="service[]" id="checkbox"  value="White Pages"/>
                    White Pages</td>
                  <td width="39%"><input type="checkbox" name="service[]" id="checkbox" value="YP Online" />
                    YP Online</td>
                  <td width="39%"><input type="checkbox" name="service[]" id="checkbox6" value="Our Sales Rep."/>
                    Our Sales Rep.</td>
                </tr>
                <tr>
                  <td width="39%"><input type="checkbox" name="service[]" id="checkbox7" value="Fine Foods/Tradeshows"/>
                    Fine Foods/Tradeshows</td>
                  <td width="39%"><input type="checkbox" name="service[]" id="checkbox8" value="Through Internet" />
                    Through Internet</td>
                  <td width="=39%"><input type="checkbox" name="service[]" id="checkbox9" value="Other" />
                    Other</td>
                </tr>
              </table></td>
            </tr>
          </table>
          <table width="100%" border="0">
            <tr>
              <td width="39%">What type of business have you got?</td>
              <td width="37%"><input type="checkbox" name="service1[]" id="checkbox10" value="Sit down coffee shop" />
                Sit down coffee shop</td>
              <td width="24%"><input type="checkbox" name="service1[]" id="checkbox11" value="Franchise Business" />
                Franchise Business</td>
            </tr>
            <tr>
              <td><input type="checkbox" name="service1[]" id="checkbox12" value="Over the counter cafe/blosk" />
                Over the counter cafe/blosk</td>
              <td><input type="checkbox" name="service1[]" id="checkbox13"value="Restaurent"  />
                Restaurent</td>
              <td><input type="checkbox" name="service1[]" id="checkbox14" value="Other" />
                Other</td>
            </tr>
          </table>          
          <table width="100%" border="0">
            <tr>
              <td>Are you considering stocking the Laguna Range?</td>
            </tr>
            <tr>
              <td><input type="checkbox" name="service2[]" id="checkbox15" value="Yes Now?" />
                Yes Now? 
                <input type="checkbox" name="service2[]" id="checkbox16" value="With in 2 weeks"/>
                With in 2 weeks 
                <input type="checkbox" name="service2[]" id="checkbox17" value="With in 4 weeks"/>
                With in 4 weeks 
                <input type="checkbox" name="service2[]" id="checkbox18" value="More than 4 weeks"/>
                More than 4 weeks 
                <input type="checkbox" name="service2[]" id="checkbox19" value="No"/> 
                No</td>
            </tr>
            <tr>
              <td>Any particular product you are intrested in(see our Range)&nbsp; :
                <input type="text" name="product" id="textfield9" /></td>
            </tr>
            <tr>
              <td>Currently which manufacturer are you using &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
                <input type="text" name="manufacturer" id="textfield10" /></td>
            </tr>
            <tr>
              <td>Any questions or comments &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 
                <input type="text" name="comments" id="textfield11" /></td>
            </tr>
          </table>          
         
              <input type="submit" name="button" id="button" onClick="return Validate()" value="Submit" /> &nbsp;  &nbsp; &nbsp;
                    
              <input type="reset" name="button2" id="button2" value="Reset" />
            </td>
      </tr>

        </table>
    </form>
        </td>
        <td width="10" align="center">&nbsp;</td>
        
      </tr>
    </table></td>
  </tr>
  
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</td>
  </tr>
</body>
</html>

I have tried your code but it is showing message like
Undefined index: Services

Let me know the solution.

Thanks in advance.

This question has already been answered. Start a new discussion instead.