a表:id address title怎么把接收到的以下2个变量插入a表!aa.php<form action="bb.php" method="post" >  <input type="text" name="address" />  <input type="text" size="50" name="title[]" />
<input type="submit" size="50" value="go" />
 </form>
bb.php$address=$_POST['address'];
$title = $_POST['title'];..........//不知道咋写了

解决方案 »

  1.   

    aa.php
    bb.php
    if($_POST['address']&&$title = $_POST['title']){
      $sql="insert into message (id,address,title) " .
       "values ('','$_POST[address]','$_POST[title]')";
      mysql_query($sql);
      echo "<script language=\"javascript\">alert('添加成功');history.go(-1)</script>"; }else{echo "没有数据";
    }
      

  2.   

    bb.php 
    if($_POST['address']&&$title = $_POST['title']){ 
      $sql="insert into a表 (id,address,title) " . 
      "values ('','$_POST[address]','$_POST[title]')"; 
      mysql_query($sql); 
      echo " <script language=\"javascript\">alert('添加成功');history.go(-1) </script>"; }else{ echo "没有数据"; 
    }
      

  3.   

    print_r($_POST)你看看这个数组.你就知道怎么用了。呵呵
      

  4.   

    <form action="bb.php" method="post" >  <input type="text" name="address[]" />  <input type="text" size="50" name="title[]" />
    <input type="submit" size="50" value="go" />
     </form>
    我传过来的是一数组(也就是有N条记录)
    这样可以?if($_POST['address']&&$title = $_POST['title']){ 
      $sql="insert into a表 (id,address,title) " . 
      "values ('','$_POST[address]','$_POST[title]')"; 
      mysql_query($sql); 
      echo " <script language=\"javascript\">alert('添加成功');history.go(-1) </script>"; }else{ echo "没有数据"; 
    }
      

  5.   

    这个代码哪有错?
    <%php
    $title = $_POST['title'];
    $address=$_POST['address']; 
    $db = mysql_connect("localhost", "root", ""); 
       if($_POST['address']&&$title = $_POST['title'])
    {   $sql="insert into test (title,address) " . 
      "values ('$_POST[title]','$_POST[address]')"; 
      mysql_query($sql,@link); 
      echo " <script language=\"javascript\">alert('添加成功');history.go(-1) </script>"; }
    else

    echo "没有数据"; 
    }
    %>
      

  6.   

    <input type="text" size="50" name="title[]" />
    这里不知道你什么意思,一个文本框你怎么给弄成数组,你的意思是不是在里面输入'a,b,c,d'类的内容
    在后台分成数组,循环数组存储到数据库呢?
      

  7.   

    aa.php<form action="bb.php" method="post" >  <input type="text" name="address" />  <input type="text" size="50" name="title" />
    <input type="submit" size="50" value="go" />
     </form>
    bb.phpif($_POST['address']&&$title = $_POST['title']){ 
      $sql="insert into a表 (id,address,title) " . 
      "values ('','$_POST[address]','$_POST[title]')"; 
      mysql_query($sql); 
      echo " <script language=\"javascript\">alert('添加成功');history.go(-1) </script>"; }else{ echo "没有数据"; 
    }