everyone.
I know this is a far treated subject, but I've looked everywhere and cannot get it solved.
I have a series of checkboxes in my webpage and need to insert the values into a database.
For what I've read, it's supposed to be done this way:
<tr>
<td class="titulofila">Salón Completo con: </td>
<td>
<table width="100%"><tr><td>
<label>
<input name="equipSalon[]" type="checkbox" id="equipSalon[]" value="mesa" />
mesas </label>
</td><td>
<label>
<input name="equipSalon[]" type="checkbox" id="equipSalon[]" value="sillas" />
sillas </label>
</td><td>
<label>
<input name="equipSalon[]" type="checkbox" id="equipSalon[]" value="sofa" />
sofá</label>
</td></tr></table>
</td>
</tr>
And then, in the PHP script that the submit button takes to:
$equipSalonF=mysql_real_escape_string(implode(',', $_POST['equipSalon']));
mysql_query("INSERT INTO markers (ciudad,
zona,address,name,
telefono,email,piso,
tipo,erasmus,nhabitaciones,
plazas,equipHabita,nbanos,
salon,cocina,electrodomesticos,
garaje,internet,calefaccion,
sexo,precio,superficie,otros,
fecha,lat,lng)
VALUES ('{$_POST['ciudad']}','{$_POST['zona']}',
'{$_POST['address']}','{$_POST['name']}','{$_POST['telefono']}',
'{$_POST['email']}','{$_POST['piso']}','{$_POST['tipo']}',
'{$_POST['erasmus']}','{$_POST['nhabitaciones']}',
'{$_POST['plazas']}','{$equipHabitaF}',
'{$_POST['nbanos']}','{$equipSalonF}',
'{$equipCocinaF}','{$equipElectroF}','{$_POST['garaje']}',
'{$_POST['internet']}','{$_POST['calefaccion']}',
'{$_POST['sexo']}','{$_POST['precio']}',
'{$_POST['superficie']}','{$_POST['otrosF']}',
'{$_POST['fecha']}','{$_POST['lat']}',
'{$_POST['lng']}'",$link);
I have more than this checkboxes and this doesn't work, just says "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 21"
If anyone wants to look at the full index.html and php files, you can have them here: http://paste.ideaslabs.com/show/8qEHDnsZdr the form starts at line 147. And the PHP File in here: http://paste.ideaslabs.com/show/IJFLSHM7Ka
Thanks in advance.