Senhores Posted October 4, 2004 Report Share Posted October 4, 2004 Ai galera to tentando cadastrar varios textos num form só, só que eu não estou conseguindo oque eu deveria fazeR?FORM<form action="grava_categoria.php" method="post" enctype="application/x-www-form-urlencoded" name="form1"> <p> <input name="cat1" type="text" id="cat1""cat1"> <select name="target1" id="target1" > <option value="_blank">_blank</option> <option value="_parent">_parent</option> <option value="_self">_self</option> <option value="_top">_top</option> </select> <br> <input name="cat2" type="text" id="cat2""cat2"> <select name="target2" id="target2"> <option value="_blank">_blank</option> <option value="_parent">_parent</option> <option value="_self">_self</option> <option value="_top">_top</option> </select> <br> <input name="cat3" type="text" id="cat3""cat3"> <select name="target3" id="target3"> <option value="_blank">_blank</option> <option value="_parent">_parent</option> <option value="_self">_self</option> <option value="_top">_top</option> </select> </p> <p> <input type="submit" name="Submit" value="Cadastrar"> </p> </form> GRAVANDO <? include("../config.php"); $categoria = $_POST["cat1"] + $_POST["cat2"] + $_POST["cat3"]; $target = $_POST["target1"] + $_POST["target2"] + $_POST["target3"]; $cadastra = "INSERT INTO categoria (categoria, target) VALUES ('$categoria', '$target')"; $consulta = mysql_query($cadastra) or die ("Não foi possivel cadastrar"); echo "Categoria cadastrada com sucesso." ?>até + Quote Link to comment Share on other sites More sharing options...
0 Fabyo Posted October 4, 2004 Report Share Posted October 4, 2004 foreach ($_POST as $campo => $valor) { $$campo = $valor; mysql_query( "INSERT INTO categoria (categoria, target) VALUES ('$categoria', '$target')");} Quote Link to comment Share on other sites More sharing options...
0 Senhores Posted October 4, 2004 Author Report Share Posted October 4, 2004 ele fica aparecendo tudo 000000na data basetem que ter algo em especial no mysql?CREATE TABLE `categoria` (`id` INT( 50 ) NOT NULL ,`usuario` VARCHAR( 255 ) NOT NULL ,`categoria` VARCHAR( 255 ) NOT NULL ,`target` VARCHAR( 255 ) NOT NULL ); Quote Link to comment Share on other sites More sharing options...
0 Gladisson Posted October 4, 2004 Report Share Posted October 4, 2004 Isso vai dar igual a zero mesmo, você está utilizando conectação de JS.Certo:$categoria = $_POST["cat1"] . $_POST["cat2] . $_POST["cat3"];$target = $_POST["target1"] . $_POST["target2] . $_POST["target3"]; Quote Link to comment Share on other sites More sharing options...
0 Senhores Posted October 4, 2004 Author Report Share Posted October 4, 2004 tipo galeraeu digito nos tres campocampo 1 >>> wacampo2 >>> gcampo3 >>>> nerai fica tudo junto wagnernu é bem isso que eu quero eu quero que fique separawagner Quote Link to comment Share on other sites More sharing options...
0 Gladisson Posted October 5, 2004 Report Share Posted October 5, 2004 não estou te entendendo. Mais veja se é isso que você quer:$categoria = $_POST["cat1"] . "\n";$categoria .= $_POST["cat2"] . "\n";$categoria .= $_POST["cat3"] . "\n";$target = $_POST["target1"] . "\n";$target .= $_POST["target2"] . "\n";$target .= $_POST["target3"] . "\n"; Quote Link to comment Share on other sites More sharing options...
0 Senhores Posted October 5, 2004 Author Report Share Posted October 5, 2004 è isso mesmo obrigadoso uma perguntinha oque isso significa?. "\n"; Quote Link to comment Share on other sites More sharing options...
0 gross Posted October 5, 2004 Report Share Posted October 5, 2004 Pular linha...\t é tabulaçãotipo"wa\ng\tner"=wag nersacou? Quote Link to comment Share on other sites More sharing options...
Question
Senhores
Ai galera to tentando cadastrar varios textos num form só, só que eu não estou conseguindo oque eu deveria fazeR?
FORM
GRAVANDOaté +
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.