3
I want to insert the contents of the combobox in the database by POST, but I can’t.
Here the excerpt from the combobox, which pulls the data from a table
<select name="cmbtimes">
<?php
//pegando os dados
while($dados = mysql_fetch_array($query))
{
//mostrando eles (dados) em forma de options
?>
<option value="<?$dados['id'] ?>">
<?= $dados['time'] ?>
</option>
<?php
}
?>
And then it goes to the.php sign-up page: (the name is a form text field)
$nomej=$_POST['nomej'];
$cmbtimes=$_POST['cmbtimes'];
$sql = mysql_query("INSERT INTO jogador(nomej, nometime) VALUES('$nomej', '$cmbtimes')");
But he won’t go ):
Error appears?
– rray
Before you try to enter, try printing the value inside $cmbtimes, see if you’re getting the correct value
– mauricio caserta
In your code you closed the select tag with
</select>
?– henriquedpereira
Are you able to enter the value of namej, but not of cmbtimes? Or neither of the two?
– Joao Paulo
Avoid using <?= ? > It’s a good practice to always use <?php ? > exite
– Jose Edinaldo
which method used in the form header?
– pc_oc