problema - inserindo no bd com list/menu
Olá!
Estou iniciando no php, e me deparei com um problema...
segue o codigo abaixo:?
<? include "../config.php";?>
<html>
<body>
<?php
$sql_modulos = 'SELECT * FROM categorias ';
$rs_modulos = mysql_query($sql_modulos);
?>
<?
echo"<select name='categorias' id='categorias'>"; ?>
<?php
while ($valores = mysql_fetch_assoc($rs_modulos)) {
print '<option value="'.$valores['nome_categoria'].'">'.$valores['nome_categoria'].'</option>';
}
?>
<form method="POST" action="inserir_anuncio.php">
ensira o nome do anuncio<input type="text" size="20" name="titulo_anuncio" value="<? echo $titulo_anuncio; ?>">
<BR>
descrição: <input type="text" size="20" name="descricao_anun" value="<? echo $descricao_anun; ?>" >
<BR>
endereço <input type="text" size="20" name="endereco" value="<? echo $endereco; ?>" >
<BR>
telefone: <input type="text" size="20" name="telefone" value="<? echo $telefone; ?>" >
<BR>
site: <input type="text" size="20" name="site" value="<? echo $site; ?>" >
<BR>
responsável: <input type="text" size="20" name="resposavel" value="<? echo $resposavel; ?>" >
<BR>
<input type="submit" value="inserir">
</select></option>
</form>
</body>
</html>
<?
$sql = "INSERT INTO anuncio (id_anuncio,titulo_anuncio,descricao_anun,endereco,telefone,site,resposavel)values ('','$titulo_anuncio','$descricao_anun','$endereco','$telefone','$site','$resposavel')";
$sql_resultado = mysql_query($sql,$conexao) or die ("n foi possivel executar a consulta");
?>Bom o botão "inserir" não funca ou seja não inserir no bd!
Não descubro o que tem de errado..=/
E aproveitando o post queria perguntar uma coisa, eu estou tentando fazer um sistema de classificados, como eu vou atribuir a categoria no anuncio?
acho que perguntei muita coisa^^
vlw
abraço
Discussão (12)
Carregando comentários...