Textareas导致问题重定向到下一页

时间:2016-10-16 05:15:13

标签: php mysql

我有一个与php链接的数据库。当我编写第一个代码时,我的网页被重定向到页面'mypage1.php'。但是当我编写第二个代码时,几乎(完全)相同,它不会被重定向到mypage1.php。在我的数据库里面的表中,我有一个我用来与php代码相关的Orderid。你能告诉我为什么第二个代码没有重定向到同一个页面? (它停留在同一页面上)。当我从第二个代码中删除文本区域代码时,网页被重定向到mypage1.php,特别是当我删除此代码时:

<input type='textarea' name='staffname'>
            </td><td>
            <input type='textarea' name='Time'>
            </td><td>
            <input type='textarea' name='custdetail'>
            </td><td>
            <input type='textarea' name='orderId'>

代码1(PHP代码):     echo“”;

echo "<tr>";
echo "<td>idSpatula</td><td>Qauntity</td><td>Staff Name</td><td>Staff Id</td><td>Customer Details</d><td>Order Id</td>";
echo "</tr>";

echo "<tr>";

echo "<form >";
echo "<td>" ."Spatula Id=3"."</td><td>

    <input type='textarea' name='3'>

    </td><td>
        <input type='textarea' name='staffname'>
        </td><td>
        <input type='textarea' name='Time'>
        </td><td>
        <input type='textarea' name='custdetail'>
        </td><td>
        <input type='textarea' name='orderId'>

        <input type='submit' id='submit' value='submit'>
        </td>

</form>";



echo "</tr>";

echo "</table>";




echo "</br>";

if(isset($_GET['3'])){
     // means submit clicked!

    $queryy3=0;
    $queryy3 = $_GET['3'];





        header('Location: mypage1.php'); 

        $sqll3 = "UPDATE Spatula SET  QuantityInStock=QuantityInStock-$queryy3  WHERE idSpatula=3 and QuantityInStock>0";
    $sqlorder3 = "insert into `Order`(idOrder, RequestedTime, ResponsibleStaffMember, CustomerDetails) values (3,'1987-04-20 11:34:09','Shubhams','tell')";

        $result1003 = mysqli_query($con, "SELECT QuantityInStock FROM Spatula where idSpatula=3");


    mysqli_query($con, $sqlorder2);


       if (mysqli_query($con, $sqll3) & $col1003['QuantityInStock']!=0 ) {
            //$sql = "UPDATE Spatula SET  QuantityInStock=QuantityInStock-$query  WHERE idSpatula= and QuantityInStock>0";
        echo "Updated"; 
        }
      while($col1003 = mysqli_fetch_array($result1003)) {
        echo $col1003['QuantityInStock'];
        if ($col1003['QuantityInStock']<=0){
              header('Location: mypage2.php'); 
         }
       }



      } 

代码2:

echo "<table border='1'>";

echo "<tr>";
echo "<td>idSpatula</td><td>Qauntity</td><td>Staff Name</td><td>Staff Id</td><td>Customer Details</d><td>Order Id</td>";
echo "</tr>";

echo "<tr>";

echo "<form >";
echo "<td>" ."Spatula Id=4"."</td><td>

    <input type='textarea' name='4'>

    </td><td>
        <input type='textarea' name='staffname'>
        </td><td>
        <input type='textarea' name='Time'>
        </td><td>
        <input type='textarea' name='custdetail'>
        </td><td>
        <input type='textarea' name='orderId'>
        </td>
    <input type='submit' id='submit' value='submit'>

</form>";



echo "</tr>";

echo "</table>";







if(isset($_GET['4'])){
     // means submit clicked!

    $queryy4=0;
    $queryy4 = $_GET['4'];




        header('Location: mypage1.php'); 

        $sqll4 = "UPDATE Spatula SET  QuantityInStock=QuantityInStock-$queryy4  WHERE idSpatula=4 and QuantityInStock>0";
    $sqlorder4 = "insert into `Order`(idOrder, RequestedTime, ResponsibleStaffMember, CustomerDetails) values (5,'1987-04-20 11:34:09','Shusss','tss')";

        $result1004 = mysqli_query($con, "SELECT QuantityInStock FROM Spatula where idSpatula=4");


    mysqli_query($con, $sqlorder4);


       if (mysqli_query($con, $sqll4) & $col1004['QuantityInStock']!=0 ) {

        echo "Updated"; 
        }
      while($col1004 = mysqli_fetch_array($result1004)) {
        echo $col1004['QuantityInStock'];
        if ($col1004['QuantityInStock']<=0){
              header('Location: mypage2.php'); 
         }
       }



      } 

0 个答案:

没有答案