-2
I have the following form
</p>
<p align="center">Nome:
<input name="nome" type="text" id="nome">
<br />
<br />
<strong>Email:</strong>
<input name="email" type="text" id="email" size="45" />
<br />
<br />
<strong>Palpites Grupo A <span class="style1">PRIMEIRA</span> Rodada dias 14/06 e 15/06</strong><br />
<textarea name="palpites" id="palpites" cols="45" rows="2">A X - X B
C X - X D
</textarea>
<br />
<br />
<strong>Palpites Grupo A <span class="style1">SEGUNDA</span> Rodada dias 19/06 e 20/06</strong><br />
<textarea name="palpites2" id="palpites2" cols="45" rows="2">A X - X C
B X - X D
</textarea>
<br />
<br />
<strong>Palpites Grupo A <span class="style1">TERCEIRA</span> Rodada dia 25/06</strong><br />
<textarea name="palpites3" id="palpites3" cols="45" rows="2">A X - X D
B X - X C
</textarea>
<br />
<br />
<input type="submit" value="Cadastrar" >
</p>
</form>
</body>
</html>
and my page register this as follows
<?php
$connect = mysql_connect('localhost','root','');
$db = mysql_select_db('copa');
$query = "INSERT INTO palpites (id,nome,email,palpites,palpites2,palpites3) VALUES ('$id','$nome','$email','$palpites','$palpites2','$palpites3')";
@mysql_query($query);
@mysql_close();//fecha conexao
?>
<script>
alert("dados gravados com sucesso") ;
</script>
// volta pra lá
<?PHP
header("Refresh: 0; /bolao/home/palpitar.php");
?>
But only the id is being sent, or actually being placed automatically by mysql, can anyone please help me? Att Alberico
You have defined the variables
$nome
,$email
, etc, which use to create the record? In the code you posted they are not defined.– Woss
It would be nice to boot that lot of @ in your code. On rare occasions this is good. And in all of them where you’re good, you have complete control of what you’re doing. Another thing that you don’t normally have in well-made code is JS Alert via PHP, and surely your header refresh is not an easy solution to debug (it probably has many better ways to do what you want without improvisations of this nature).
– Bacco
Anderson good afternoon, I do not have much knowledge, how so defined ? Because in the database I created the same way.
– Joaquim Alberico
The HTML code is incomplete, which method you are using in the form, GET or POST?
– RpgBoss
Have you thought about using codeigniter is very useful and will help you a lot
– Gustavo Castro
If any answer solved your problem mark it as accepted, see how and why in https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– user60252