Вопрос

i have problems on "echos with td elements", only on the first select of the form, because the other code that i have works well only if the first select works....

So, that's my code:

$stallFirstSel=oci_parse($conn, 'SELECT * FROM ACTIVIDAD');
oci_execute($stallFirstSel);
echo "<table><tr>";
echo "<td><form id='formActis' method='POST' action='reserves_es.php'>";
echo "<select name='selActi[]'>";
while (($row=oci_fetch_array($stallFirstSel,OCI_BOTH))!=false){
      echo "<option id='optActi'>".$row['NOM']."</option>";
}
echo "</select>";
echo "<td><input type='submit' value='Enviar'></td>";
echo "</form></td></tr>";

And if i modify it deleting all the td tags, it works well and all the other code works too because i have the condition if(isset($_POST['selActi'])):

$stallFirstSel=oci_parse($conn, 'SELECT * FROM ACTIVIDAD');
oci_execute($stallFirstSel);
echo "<table><tr>";
echo "<form id='formActis' method='POST' action='reserves_es.php'>";
echo "<select name='selActi[]'>";
while (($row=oci_fetch_array($stallFirstSel,OCI_BOTH))!=false){
      echo "<option id='optActi'>".$row['NOM']."</option>";
}
echo "</select>";
echo "<input type='submit' value='Enviar'>";
echo "</form></tr>";

That's all, if anyone can help me or know how to fix it? Thanks

Это было полезно?

Решение 3

use this code

Example 1

$stallFirstSel=oci_parse($conn, 'SELECT * FROM ACTIVIDAD');
oci_execute($stallFirstSel);
echo "<form id='formActis' method='POST' action='reserves_es.php'><table><tr>";
echo "<td>";
echo "<select name='selActi[]'>";
while (($row=oci_fetch_array($stallFirstSel,OCI_BOTH))!=false){
      echo "<option id='optActi'>".$row['NOM']."</option>";
}
echo "</select>";
echo "</td><td><input type='submit' value='Enviar'></td>";
echo " </tr></table></form>";

Example 2

$stallFirstSel=oci_parse($conn, 'SELECT * FROM ACTIVIDAD');
oci_execute($stallFirstSel);
echo "<table><tr>";
echo "<td><form id='formActis' method='POST' action='reserves_es.php'>";
echo "<select name='selActi[]'>";
while (($row=oci_fetch_array($stallFirstSel,OCI_BOTH))!=false){
      echo "<option id='optActi'>".$row['NOM']."</option>";
}
echo "</select>";
echo " &nbsp; <input type='submit' value='Enviar'></form></td>";
echo " </tr></table>";

Другие советы

You missed a (closing tag) after the while { }
echo "";

You are using <td> tag recursively without statring new <table>.

Here is your clear code.

$stallFirstSel=oci_parse($conn, 'SELECT * FROM ACTIVIDAD');
oci_execute($stallFirstSel);
echo "<form id='formActis' method='POST' action='reserves_es.php'>";
echo "<table>";
    echo "<tr>";
        echo "<td>";
            echo "<select name='selActi[]'>";
            while (($row=oci_fetch_array($stallFirstSel,OCI_BOTH))!=false){
                  echo "<option id='optActi'>".$row['NOM']."</option>";
            }
            echo "</select>";
        echo "</td>";
        echo "<td>";
            echo "<input type='submit' value='Enviar'>";
        echo "</td>";
    echo "</tr>";
echo "</table>";
echo "</form>";
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top