Firefox不提交我的表单


Firefox does not submit my form

我有一个php应用程序,从mysql数据库获取请求并显示它们以供进一步批准。表单从send_req.php获取,并显示在showrequests.php的div中。这是send_req.php

的代码
<table style="border:0;border-color:transparent">
<tr style="background-color:lightblue">
<td>Product ID</td>
<td>Name</td>
<td>Quantity</td>
<td><input type="checkbox" name="selectAll" /></td>
<td>Authorized Quantity</td>
</tr>
<form method="post" action="send_req.php">
<?php
$reqNum = $_POST['rId'];
echo "<h3>Request # $reqNum</h3>";
$showReqs = mysql_query("Select * from request where request_number='".$reqNum."' and status=0");
    while($resultA = mysql_fetch_array($showReqs))
    {
        $rBy = $resultA['requested_by'];
        $rTime = $resultA['request_time'];
        $rId = $resultA['id'];
        $pId = $resultA['product_id'];
        $getPrName = mysql_query("select name from products where id='$pId'");
        $prN = mysql_fetch_array($getPrName);
        $prName = $prN['name'];
        $rQuantity = $resultA['requested_quantity'];
        $status = $resultA['status'];
?>
    <tr>
        <input type="hidden" name="rId[]" value="<?php echo $rId; ?>"/>
    <td style="background-color:orange"><input type="text" name="prId[]" value="<?php echo $pId; ?>" readonly="readonly" style="border:0px"/></td>
    <td style="background-color:orange"><input type="text" name="prName[]" value="<?php echo $prName; ?>" readonly="readonly" style="border:0px"/></td>
    <td style="background-color:orange"><input type="text" name="quantity[]" value="<?php echo $rQuantity; ?>" readonly="readonly" style="border:0px"/></td>
    <td style="background-color:orange"></td>
    <td><input type="text" name="pQuantity[]" /></td>
    </tr>
<?php }
?>
    <tr>
<td></td>
<td></td>
<td></td>
<input type="hidden" name="rNum" value="<?php echo $reqNum; ?>" />
<td></td>
<td><input type="submit" name="submitReq" value="Send" id="submit_req" style="backgroundColor:Transparent;border:0;color:blue;width:100;"/></td>
</tr>
</form>
</table>
<?php
echo "Requested By:$rBy at ".substr($rTime,11,18)." ".substr($rTime,0,10);
?>

这是showrequests.php页面

<html>
<head>
<script type="text/javascript">
function getRequest(ob)
{
    var id = ob.id;
    if(window.XMLHttpRequest)
{
    ajaxOb = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
    ajaxOb = new ActiveXObject("Microsoft.XMLHTTP");
}  
     ajaxOb.open("POST", "send_req.php");   
     ajaxOb.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                    
     ajaxOb.send("rId=" + id);  
     ajaxOb.onreadystatechange = function()  
    {  
        if(ajaxOb.readyState == 4)
        {
            if(ajaxOb.status == 200)
            {
                document.getElementById("showTable").innerHTML = ajaxOb.responseText;
            }
        }
    }  
}
</script>
</head>
<body>
<?php
$mysql_con = mysql_connect("localhost","root","") or die("Could not connect ".mysql_error());
$mysql_db = mysql_select_db("cart",$mysql_con) or die("Unable to select db ".mysql_error());
echo "<h2 align='center'>Pending Requests</h2>";
$showReq = mysql_query("Select distinct(request_number) as rNums from request where status=0");
?>
<div style="float:left;margin-right:15px;">
<br/>
<?php
while($result = mysql_fetch_array($showReq))
{
    $rNum = $result['rNums'];
?>
<input type="button" name="fetchReq" id="<?php echo $rNum; ?>" value="<?php echo "Request # $rNum"; ?>" style="margin-bottom:5px;backgroundColor:Transparent;border:0;color:blue;width:100;text-Decoration:underline" onclick="getRequest(this)"/>
<?php
    echo "<br/>";
}
?>
</div>
<div id="showTable" style="float: left">
</div>
</body>
</html>

我现在的问题是,一切工作正常在chrome和IE,但表单不提交时,我点击提交按钮在firefox。我用的是firefox 20.0.1。更新:我已经从send_req.php中删除了html,head and body标签

不允许在表中使用表单。请参见表内的表单

问候,迈克尔。

提醒:HTML文档的结构是:

<!-- No div before html tag -->
    <!DOCTYPE html> <!-- Doctype for HTML5 ; use whatever doctype you need -->
    <html>
        <head>
        </head>
        <!-- No div before body tag -->
        <body>
             <!-- Divs only belongs here -->
        </body>    
    </html>
<!-- No div after html tag -->

如果你不遵循这个基本结构,你就迫使浏览器解释你的无效代码(当你不提供doctype时+ quirks模式)。

有些浏览器能很好地猜到你想要做什么,有些则不能,比如Firefox。

请使用HTML验证器作为W3的验证器来检查您的语法

相关文章: