2015-05-02 42 views
0

这是我的bagıs.php文件,它与bagısyap.php文件连接。Php连接文件之间的错误

<? php 
    if (loggedin()) { 
    require 'bagısyap.php'; 

    include 'connect.inc.php'; 
    include 'core.inc.php'; 
    include 'bagısyap.php'; 
    if (isset($_POST['esyaara2']) && isset($_POST['il']) && isset($_POST['adet'])) { 
     $esyaadi = $_POST['esyaara2']; 
     $il = $_POST['il']; 
     $adet = $_POST['adet']; 
     if (!empty($esyaadi) && !empty($il) && !empty($adet)) { 
     echo 'OK'; 
     } else { 
     echo 'alanların hepsini doldurunuz!'; 
     } 

    } ?> 

下面这个文件是bagısyap.php文件,其中包含形式bagıs.php 我想从bagıs.php获取表单中的数据,但我不能让它

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> 
<html> 

<body> 
    <div style="background:white;height:320px; width:660px;margin-left:16%;margin-top:1%"> 
    <p>deneme 1.3.1</p> 
    <h3 style="padding:0px 0px 0px 200px"><strong><ins>Bağış Yap</ins></strong></h3> 
    <p stye="padding:0px 0px 0px 250px">Fazla eşyalarınızı ihtiyaç sahiplerine gönderebilir ; yada ihtiyacınız olan eşyaları isteyebilirsiniz</p> 
    <form action="bagıs.php" method="POST" style="padding:0px 0px 0px 200px"> 
     <br> 
     <select name="cars"> 
     <option value="giysi">Giysi</option> 
     <option value="ayakkabı">Ayakkabı</option> 
     <option value="caır">Çadır</option> 
     <option value="hırdavat">Hırdavat</option> 
     <option value="diger">Diğer</option> 
     </select> 
     <br>Eşya yazınız 
     <br> 
     <input type="text" name="esyaara2" placeholder="Eşya yazınız"></input> 
     <br>Şehir Giriniz 
     <br> 

     <input type="text" name="il" placeholder="Şehir Giriniz"></input> 
     <br>Adet 
     <br> 
     <input type="text" name="adet" placeholder="Adet"></input> 
     <br> 
     <br> 
     <input type="submit" name="kayıt" value="Kayıt"></input> 
     <br> 
     <br> 
    </form> 
    </div> 
</body> 
</html> 
+0

你有什么问题?你为什么不能得到它? – Adviov

+0

我无法从bagısyap.php获取表单的值。 –

+0

我明白,但是你得到一个错误?你究竟在哪里卡住了,你试过了什么? – Adviov

回答

0

我改变TEbagısyap.php(表单操作)

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><html> 
<body> 


<div style="background:white;height:320px; width:660px;margin-left:16%;margin-top:1%"> 
    <p>deneme 1.3.1</p> 
    <h3 style="padding:0px 0px 0px 200px"><strong><ins>Bağış Yap</ins></strong></h3> 
    <p stye="padding:0px 0px 0px 250px"> 
Fazla eşyalarınızı ihtiyaç sahiplerine gönderebilir ; yada ihtiyacınız olan eşyaları isteyebilirsiniz</p> 
    <form action="<?php function isempty(){if(isset($_POST['esyaara2'])&&isset($_POST['il'])&&isset($_POST['adet'])){return true;}else{return false;}}?>" method="POST" style="padding:0px 0px 0px 200px"><br><select name="cars"> 
<option value="giysi">Giysi</option> 
<option value="ayakkabı">Ayakkabı</option> 
<option value="caır">Çadır</option> 
<option value="hırdavat">Hırdavat</option> 
<option value="diger">Diğer</option> 
</select><br>Eşya yazınız<br> 
       <input type="text" name="esyaara2" placeholder="Eşya yazınız"></input><br>Şehir Giriniz<br> 


<input type="text" name="il" placeholder="Şehir Giriniz"></input><br>Adet<br> 
<input type="text" name="adet" placeholder="Adet"></input><br><br> 
<input type="submit" name="kayıt" value="Kayıt"></input><br><br> 
     </form> 
     <?php if(isempty()){ 
        $esyaadi=$_POST['esyaara2']; 
        $il=$_POST['il']; 
        $adet=$_POST['adet']; 
        if(!empty($esyaadi)&&!empty($il)&&!empty($adet)){ 
        require 'connect.inc.php'; 
          if(loggedin()){ 
          $userid=getusersfield('id'); 
          } 
     $query="INSERT INTO `esya_bagis` VALUES ('', ".mysql_real_escape_string($esyaadi)." , 'giyim' , ".mysql_real_escape_string($adet)." , ".mysql_real_escape_string($il)." , $userid)"; 
         if($query_run=mysql_query($query)){ 
          header("Location: bagısregister.php");  
         }else{ 
          echo mysql_error(); 
         } 
        } 
        else{ 
        echo 'alanların hepsini doldurunuz!'; 
        } 

       }?> 

    </div> 

</body> 
</html> 

我可以从窗体中获取值。