Llaverola Posted December 10, 2007 at 04:42 AM Report Share #153315 Posted December 10, 2007 at 04:42 AM TENHO ESTA DUVIDA: estou a imprimir 1 textfield dentro de cada campo da tabela abaixo mas esta-me a dar um erro, imprime 3 textfields num campo, onde deveria imprimir 1 textfield em cada campo. são 3 campos....o que devo mudar para imprimir bem???? <?php while($reg=mysql_fetch_array($resultado)){ $nomeA=$reg["aluno"]; echo "<tr> <td style='text-align:center;'>$nomeA</td> <td style='text-align:center;'>"?> <input type="text" id="nota" name="nota" class="input-box"><br> <?php "</td> <td style='text-align:center;'>"?> <input type="text" id="tipo" name="tipo" class="input-box"><br> <?php "</td> <td style='text-align:center;'>"?> <input type="text" id="data" name="data" class="input-box"><br> <?php "</td> </tr>"; } print("</table>"); }?> Link to comment Share on other sites More sharing options...
Kyu Posted December 10, 2007 at 09:16 AM Report Share #153322 Posted December 10, 2007 at 09:16 AM falta-te abrir a tag table: <?php echo "<table>"; while($reg=mysql_fetch_array($resultado)){ (...) "You leave nothing but death and horror in your wake!""Now, that's not fair, sometimes there's fire too" Link to comment Share on other sites More sharing options...
Llaverola Posted December 10, 2007 at 03:43 PM Author Report Share #153371 Posted December 10, 2007 at 03:43 PM continua a dar um erro marado. n imprime a tabela 🙂 <?php $disciplina=$_POST['tabela']; ?> <?php $pesquisa= "SELECT aluno FROM inscricao WHERE disciplina='$disciplina'"; $resultado=mysql_query($pesquisa) or die(mysql_error()); print("<table>"); if ($resultado){ print("<table width=20% align=center border=4 top:10em text-align=center>"); print("<tr bgcolor=Silver> <td style='text-align:center;'><h5>Numero</h5></td> <td style='text-align:center;'><h5>Nota</h5></td> <td style='text-align:center;'><h5>Tipo</h5></td> <td style='text-align:center;'><h5>Data</h5></td> </tr>"); ?> <form name='loginform' method='post'> <?php while($reg=mysql_fetch_array($resultado)){ $nomeA=$reg["aluno"]; echo "<tr> <td style='text-align:center;'>$nomeA</td> <td style='text-align:center;'>"?><input type="text" id="nota" name="nota" class="input-box"><br><?php"</td> <td style='text-align:center;'>"?><input type="text" id="tipo" name="tipo" class="input-box"><br><?php"</td> É AQUI O ERRO <td style='text-align:center;'>"?><input type="text" id="data" name="data" class="input-box"><br><?php"</td> </tr>"; } print("</table>"); }?> <input type="submit" name="enviar-button" value="Enviar" class="submit-button"> </form> <?php $nota = $_POST['nota']; $tipo = $_POST['tipo']; if(($nota != '')) { $pesquisa="select aluno,nome from inscricao,alunos where disciplina=$numero and inscricao.aluno = alunos.aluno_id"; $resultado=mysql_query($pesquisa) or die(mysql_error()); } Link to comment Share on other sites More sharing options...
fnds Posted December 14, 2007 at 12:39 PM Report Share #154265 Posted December 14, 2007 at 12:39 PM print("<table>"); não tem nada a haver, mas usa echo em vez de print, por uma questão de preformance. em vez de isto while($reg=mysql_fetch_array($resultado)){ $nomeA=$reg["aluno"]; echo "<tr> <td style='text-align:center;'>$nomeA</td> <td style='text-align:center;'>"?><input type="text" id="nota" name="nota" class="input-box"><br><?php"</td> <td style='text-align:center;'>"?><input type="text" id="tipo" name="tipo" class="input-box"><br><?php"</td> É AQUI O ERRO <td style='text-align:center;'>"?><input type="text" id="data" name="data" class="input-box"><br><?php"</td> </tr>"; } não devia de ser isto while($reg=mysql_fetch_array($resultado)){ $nomeA=$reg["aluno"]; echo " <tr> <td style='text-align:center;'>$nomeA</td> <td style='text-align:center;'><input type='text' id='nota' name='nota' class='input-box'><br></td> <td style='text-align:center;'><input type='text' id='tipo' name='tipo' class='input-box'><br></td> <td style='text-align:center;'><input type='text' id='data' name='data' class='input-box'><br></td> </tr> "; } ou isto while($reg=mysql_fetch_array($resultado)){ $nomeA=$reg["aluno"]; ?> <tr> <td style='text-align:center;'><?php echo $nomeA ?></td> <td style='text-align:center;'><input type='text' id='nota' name='nota' class='input-box'><br></td> <td style='text-align:center;'><input type='text' id='tipo' name='tipo' class='input-box'><br></td> <td style='text-align:center;'><input type='text' id='data' name='data' class='input-box'><br></td> </tr> <?php } ?> ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now