Jump to content
Fórum Script Brasil
  • 0

Cadastrando Varios Texto Num Form Só


Senhores

Question

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é +

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

não estou te entendendo. huh.gif

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";

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...