I Currently have a form where we have people putting an application forward and the form consists of this code:
<label for="age">Age Group:<span class="red">*</span></label><br/>//here!!!!
<input name="age" type="checkbox" value="11s">11/under
<input name="age" type="checkbox" value="13s">13/under
<input name="age" type="checkbox" value="17s">17/under
<input name="age" type="checkbox" value="open">Open
<em>If trailing for two age groups please ensure both age groups are ticked, refer to Rep Protocols items 5.6 & 5.7</em>
We have an area where the applicant have to select the age group, they are able to select two age groups but when submitted into the database it takes the lower one in the selected check boxes. Is there a way to allow the field if two are selected to enter two.
Also Second Question apart from that when the data is entered into the mysql database it creates the new row with the information but also creates a row with nothing in it just blank data or zeros. Whats the best way to stop this?
Here is the php database code:
<?php
//Define Parameters
$DBhost = "localhost";
$DBuser = "bdna";
$DBpass="2010";
$DBname="bdna";
$table="trails";
//connect to DB
$con = mysql_connect($DBhost,$DBuser,$DBpass);
if(!$con) { die('Could not connect to database: ' . mysql_error()); }
//Select Database
mysql_select_db("$DBname") or die("Unable to select database $DBname");
//Insert Data Into MYSQL
$sql="INSERT INTO $table (id, Name, Address, Suburb, Postcode, HomePhone, Mobile, DateofBirth, AgeNextYear, VNA, Email, ParentMobile, Club, AgeGroup, Position1, Position2)
VALUES(' ','$_POST[Name]','$_POST[Address]','$_POST[Suburb]','$_POST[Postcode]','$_POST[Phone]','$_POST[Mobile]','$_POST[dobd]/$_POST[dobm]/$_POST[doby]','$_POST[nextage]','$_POST[VNA]','$_POST[email]','$_POST[parentM]','$_POST[Club]','$_POST[age]','$_POST[pref1]','$_POST[pref2]')";
//Executes
if(!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
//Close Connection
mysql_close($con)
?>