我的php不适用于元素td,但没有它效果很好

时间:2014-03-21 09:26:28

标签: php oracle10g oci

我在“回声与td元素”上遇到问题,只在表单的第一个选择上,因为只有第一个选择有效时我才能正常工作的其他代码.... / p>

所以,这是我的代码:

$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>";

如果我修改它删除所有td标签,它运行良好,所有其他代码也有效,因为我有条件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>";

这就是全部,如果有人可以帮助我或知道如何解决它?感谢

3 个答案:

答案 0 :(得分:0)

在{}之后你错过了一个(结束标签)      echo&#34;&#34;;

答案 1 :(得分:0)

您正在递归使用<td>标记而未启动新的<table>

这是您明确的代码。

$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>";

答案 2 :(得分:-1)

使用此代码

示例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>";

示例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>";