Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Checkboxes are only posted when they are ticked. So if the checkbox is not ticked, is will not appear in <code>$_POST</code>. Also you should generally not give any values to checkboxes. Instead use names to distinguish between them.</p> <p>In the database I usually represent checkboxes with tinyints and store 1 for checked and 0 for unchecked.</p> <pre><code>// If your checkbox name is foo, this will convert it // into a value that can be stored in the database $foo = isset($_POST['foo']) ? 1 : 0; </code></pre> <p>Also note that html requires ids to be unique. So you can't have multiple elements with the same id. And you should sanitize your inputs to prevent sql injection. Use <code>mysql_real_escape_string()</code> on user inputs that go in the database.</p> <p><strong>Update</strong></p> <p>The main issue is that the query is missing a '<code>)</code>' at the last line. The query should look like</p> <pre><code>$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']}')"; mysql_query($query, $link); </code></pre> <p>Note the closing '<code>)</code>' on the last line of the query. Also note that creating the query like this, in a variable, allows you to output the created query so you can see what exactly is sent to MySQL and you also can test your query in a different environment (ie in phpmyadmin or any other database administration tool).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload