<form action="execute_new.php" id="modalform" method="post">
<td width="147"> <strong>
<font color="#033">Sticker No:</font><font color="#FF0000">*</font></td>
<td width="146"><input type="text" name="stickerno" /></td>
<tr>
<td><strong>
<font color="#033">TO : </font></td>
</tr>
<tr>
<td >
<input name="fname" type="text" />
</td>
<td >
<input name="mname" type="text" />
</td>
<td width="143" align="right">
<input name="lname" type="text" />
</td>
</tr>
<tr>
<td>
First Name</font><font color="#FF0000">*</font>
</td>
<td >
Middle Name</font><font color="#FF0000">*</font>
</td>
<td>
Last Name</font><font color="#FF0000">*</font>
</td>
</tr>
</table><br>
<br>
<table>
<tr>
<td><strong>
<font color="#033"> ADDRESS:</font></font><font color="#FF0000">*</font> </td>
<td align="center"><input name="address" type="text" value="" size="70"></td>
</tr>
</table>
<p> </p>
<font color="#033">
<table border="15" bgcolor="#00FF66" bordercolor="#000000" width="650" cellpadding="1" cellspacing="1">
<br>
<br>
<tr>
<td >LICENSE NO:<font color="#FF0000">*</font></td>
<td align="center"><input type="text" name="license"/></td>
<td >BIRTH DATE:</td>
<td align="center"><input name="bdate" id="demo1" type="text"><a href="javascript:NewCal('demo1','ddmmmyyyy',true,12)"><img src="cal.gif" width="16" height="16" border="0"></a></td>
<tr>
<td >PLATE NO:<font color="#FF0000">*</font></td>
<td align="center"><input type="text" name="plateno"/></td>
<td >PUV BODY NAME:</td>
<td align="center"><input type="text" name="puvbname" /></td>
</tr>
<tr>
<td >TYPE OF VEHICLE:</td>
<td align="center"><select id="vehicletype" name="vehicletype" style="width:134px">
<option value="Private">Private</option>
<option value="Public">Public</option>
</select>
<td >PUV BODY NO:</td>
<td align="center"><input type="text" name="puvbno" /></td>
</tr>
<tr>
<td >OWNER OF VEHICLE:</td>
<td align="center"><input type="text" name="vehicleowner" /></td>
<td >ADDRESS:</td>
<td align="center"><input type="text" name="taddress" /></td>
</tr>
<tr>
<td >PLACE OF VIOLATION:<font color="#FF0000">*</font></td>
<td align="center"><input type="text" name="violationplace" /></td>
<td>DATE / TIME:<font color="#FF0000">*</font></td>
<td align="center"><input name="datetime" id="demo2" type="text"><a href="javascript:NewCal('demo2','ddmmmyyyy',true,12)"><img src="cal.gif" width="16" height="16" border="0"></a>
</tr>
</table><br>
<table border="15" bordercolor="#000000" width="150" cellpadding="1" cellspacing="1">
<tr>Confiscated:</tr>
<br>
<tr><td><input type="radio" name="RadioGroup1" value="License ID" id="RadioGroup1_0" checked>License ID</tr><br>
<tr><td><input type="radio" name="RadioGroup1" value="License O.R." id="RadioGroup1_1">License O.R.</tr>
<tr>
<td> <input type="radio" name="RadioGroup1" value="TCP/TOP" id="RadioGroup1_2">
TCP/TOP</tr>
<tr><td><input type="radio" name="RadioGroup1" value="License Plate" id="RadioGroup1_3">
License Plate</tr>
<tr><td><input type="radio" name="RadioGroup1" value="Not Confiscated" id="RadioGroup1_4">
Not Confiscated</tr>
</tr></table><br />
<center><strong>You are hereby cited for committing the traffic violations / checked hereunder</strong><br /></center>
<br>
<br> <table width="100%px" border="7" cellspacing="1" cellpadding="1" bordercolordark="#000000" style="font-size:13px">
<tr>
<td><input type="checkbox" name="cbox[]" value="Unattended/Illegaly Parked Vehicle" />
Unattended / Illegaly Parked Vehicle</td>
<td><input type="checkbox" name="cbox[]" value="Out of Line Operation/Route Violation" />
Out of Line Operation/Route Violation</br></td>
<tr>
<td><input type="checkbox" name="cbox[]" value="Illegal Parking" />
Illegal Parking</td>
<td><input type="checkbox" name="cbox[]" value="Trip Cutting" />
Trip Cutting</br></td>
<tr>
<td><input type="checkbox" name="cbox[]" value="Illegal Topload" />
Illegal Topload</td>
<td>
<input type="checkbox" name="cbox[]" value="Over Charging" />
Over Charging</td></tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Truck Ban/Tricycle Ban" />
Truck Ban/Tricycle Ban</td>
<td><input type="checkbox" name="cbox[]" value="Refusal to Convey Passenger"/>
Refusal to Convey Passenger</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Driving in Slippers/Sleeveless shirt" />
Driving in Slippers/Sleeveless shirt</td>
<td>
<input type="checkbox" name="cbox[]" value="Overspeeding/Drag Racing/Reckless Driving" />Overspeeding/Drag Racing/Reckless Driving</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Driving w/o License/Expired/Invalid License" />
Driving w/o License/Expired/Invalid License</td>
<td><input type="checkbox" name="cbox[]" value="One-way Street Violation" />One-way Street Violation</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="No PUV ID" />
No PUV ID</td>
<td><input type="checkbox" name="cbox[]" value="Illegal Loading/Unloading" />Illegal Loading/Unloading</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Driving Dilapidated">
Driving Dilapidated</td>
<td><input type="checkbox" name="cbox[]" value="Traffic Obstruction"/>Traffic Obstruction</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Junk Vehicle" />
Junk Vehicle</td>
<td><input type="checkbox" name="cbox[]" value="Disregarding Traffic Sign/Light" />Disregarding Traffic Sign/Light</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="No Smoking 20% Discount Sticker" />
No "No Smoking"/20% Discount Sticker</td>
<td><input type="checkbox" name="cbox[]" value="Illegal Blowing of Horn" />Illegal Blowing of Horn</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="No Permit Decalsticker" />
No Permit Decalsticker</td>
<td><input type="checkbox" name="cbox[]" value="Failure to obey Police Order" />Failure to obey Police Order</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Stereo Set Operated at Excessive Sound Volume" />
Stereo Set Operated at Excessive Sound Volume</td>
<td>
<input type="checkbox" name="cbox[]" value="No Helmet/Head Gear" />
No Helmet/Head Gear</td>
<tr>
<td><input type="checkbox" name="cbox[]" value="No Trash Can/Receptacle" />
No Trash Can/Receptacle</td>
<td><input type="checkbox" name="cbox[]" value="Smoke Belching" />
Smoke Belching</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Colorum PUV" />
Colorum PUV</td>
<td><input type="checkbox" name="cbox[]" value="Failure to Switch Headlights" />Failure to Switch Headlights</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="No Plate" />
No Plate</td>
<td><input type="checkbox" name="cbox[]" value="No U-turn" /> No U-turn</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Driving under the Influence of Liquor" />
Driving under the Influence of Liquor</td>
<td><input type="checkbox" name="cbox[]" value="Dirty Plate" />
Dirty Plate</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Counter Flow" />
Counter Flow</td>
<td><input type="checkbox" name="cbox[]" value="Arrogant Driver/Conductor" />Arrogant Driver/Conductor</td>
</tr>
<tr>
<td><input type="checkbox" name="cbox[]" value="Driver's/Conductor's Uniform/I.D." />
Driver's/Conductor's Uniform / I.D.</td>
<td><input type="text" name="oviolation" />
Other Traffic Violations(Specify)</td>
</tr></table>
<br>
</label>
<p align="center">
<p align="center"><strong>Apprehending Office ( Rank & Name )</strong><font color="#FF0000">*</font></p>
<label> </label>
<select name="type" size="1">
<option>Job Order</option>
<option>Permanent</option>
</select>
<input type="text" name="officer" placeholder="Officer Name"/>
</p>
<h5 align="center">PUBLIC ORDER & SAFETY OFFICE</h5>
<h5 align="center"> </h5>
<h5 align="center">
</h5>
</font>
<input type="submit" name="register" value="Add" class="adds"/>
<input type="reset" name="cancel" value="Reset" class="add"/>
<br />
</h5>
</form>
<?php
date_default_timezone_set('Asia/Manila');
$conn=mysql_connect("localhost","root","");
mysql_select_db("dbposo",$conn);
if(isset($_POST['register']))
{
$license=$_POST['license'];
$query = mysql_query("SELECT * FROM tblviolator WHERE license = '$license'");
$fetch_rows = mysql_num_rows($query);
if ( $fetch_rows > 0 )
{
echo "<script>alert('License # already exist')</script>";
header("Refresh: 0;url=new.php");
}
elseif( empty($_POST['stickerno']))
{
echo "<script>alert('Please check if all the * marker field is filled!')</script>";
header("Refresh: 0;url=new.php");
}
else
{
$stickerno=$_POST['stickerno'];
$fname=$_POST['fname'];
$mname=$_POST['mname'];
$lname=$_POST['lname'];
$address=$_POST['address'];
$bdate=$_POST['bdate'];
$plateno=$_POST['plateno'];
$puvbname=$_POST['puvbname'];
$vehicletype=$_POST['vehicletype'];
$puvbno=$_POST['puvbno'];
$vehicleowner=$_POST['vehicleowner'];
$taddress=$_POST['taddress'];
$violationplace=$_POST['violationplace'];
$datetime=$_POST['datetime'];
$confiscated=$_POST['RadioGroup1'];
$violation=$_POST['cbox'];
$oviolation=$_POST['oviolation'];
$type=$_POST['type'];
$officer=$_POST['officer'];
mysql_query("insert into tblviolator(license, stickerno, fname, mname, lname, address, bdate, plateno, puvbname, vehicletype, puvbno, vehicleowner, taddress, violationplace, datetime, confiscated, violation, oviolation, type, officer) values('$license','$stickerno','$fname','$mname','$lname','$address','$bdate','$plateno','$puvbname','$vehicletype','$puvbno','$vehicleowner','$taddress','$violationplace','$datetime','$confiscated','$violation','$oviolation','$type','$officer')",$conn) or die(mysql_error());
echo "<script>alert('Successfully Recorded, <br>
First penalty: 100php!')</script>";
header("Refresh: 0;url=new.php");
}
}
?>
What is my error here?
$violation=$_POST['cbox'];to$violation=implode(',' $_POST['cbox'])because $violation will be array if you select more than one option