Firefox不提交我的表单

时间:2013-04-27 15:39:45

标签: php javascript html ajax firefox

我有一个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。更新:我已从html,head and body中删除了send_req.php代码 仍然没有工作

2 个答案:

答案 0 :(得分:1)

表中不允许使用

表单。请参阅 Form inside a table

此致 迈克尔

答案 1 :(得分:0)

提醒: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's validator来检查语法。

相关问题