
VinxOne
(usa Ubuntu)
Enviado em 22/08/2012 - 11:28h
Bom dia, gente! Sou iniciante em PHP, por favor me ajudem. Estou aprendendo através de um livro e está havendo algum erro que eu tenho certeza que é algo bobo. O último campo do meu formulário não armazena nenhum valor.
Código do form:
<form action="formteste.php" method=POST>
<table border="0">
<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantidade</td>
</tr>
<tr>
<td>Teste1</td>
<td align="center"><input type="text" name="test1" size="3" maxlength="3" /></td>
</tr>
<tr>
<td>Teste2</td>
<td align="center"><input type="text" name="test2" size="3" maxlength="3" /></td>
</tr>
<tr>
<td>Teste3</td>
<td align="center"><input type="text" name="test3" size="3" maxlength="3" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Enviar" /></td>
</tr>
</table>
</form>
Script PHP:
<?php
$test1 = isset($_POST['test1']) ? $_POST['test1']:'';
$test2=isset($_POST['test2'])?$_POST['test2']:'';
$test3=isset($_POST['test3'])?$_POST['test3']:'';
print ("Seu pedido foi o seguinte:<br>\n");
print ("Teste1: $test1 <br>\n");
print ("Teste2: $test2 <br>\n");
print ("Teste3: $test3 <br>\n");
?>
A saída é essa:
Teste1: 5
Teste2: 1
Teste3:
O que pode estar acontecendo? Não consigo encontrar nenhum erro.