Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>after reading your comment. it seems you are trying to send a rows of data. insted of putting for element name and id like the following </p> <pre><code>name="asignatura_lun_'+cuentaInputs+'" </code></pre> <p>use array indexing </p> <pre><code>name="asignatura_lun['+cuentaInputs+']" </code></pre> <p>this way you'll get following arrays in php</p> <pre><code>$_POST['hora'] $_POST['asignatura_lun'] $_POST['id_usuario_lun'] //likewise for mar, mie, jue and vie </code></pre> <p>at the php side loop for hora array using foreach</p> <pre><code>foreach($_POST['hora'] as $key =&gt; $value) //use $key for referencing other arrays. { for($j=1; $j&lt;6; $j++) { if($j==1) { //use $key for referencing other arrays. $asignatura=$_POST["asignatura_lun"][$key]; $id_usuario=$_POST["id_usuario_lun"][$key]; $hora=$value; //$value is current horra $consulta = "INSERT INTO horarios (asignatura, curso, clase, fecha, hora, id_usuario) VALUES ('$asignatura', '$curso','$clase','lunes','$hora','$id_usuario')"; echo $consulta; } //same for other weekdays } } </code></pre> <p><strong>Reference</strong>: Read this <a href="https://stackoverflow.com/q/18723457/656539">question and answer</a>.</p> <hr> <p>Before Edit :</p> <p>I really cant understand most of your code. Please try to use english identifiers. but on a brief look, using a hidden input element should solve your problem. add this in your form which submits to procesar_horario.php</p> <pre><code>&lt;input type='hidden' name='cuentaInputs' id='cuentaInputs'/&gt; </code></pre> <p>you can update its value whenever you update cuentaInputs.</p> <pre><code>$('#cuentaInputs').val(cuentaInputs); </code></pre>
    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.
 

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