Jump to content

DUVIDA NUMA TABELA


Llaverola

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.