(php)如何使我的提交按钮工作,即

时间:2010-04-12 14:29:29

标签: html forms internet-explorer

我的表单在firefox中运行但不是。我尝试使用隐藏文本字段(失败)...我尝试使用图像而不是提交按钮(失败)...还有其他解决方案吗?这是我的表格:

<?php

print "<table width='522' cellpadding='2' cellspacing='0' border='0'>
<tr><td valign='top' width='128'><img src='logo.gif' border='0'></td><td valign='bottom'><div style='padding-top: 10; font-family: arial; font-size: 14px;'
<form action='' method='GET'>
Search category
<select name='cat'><option value='1'"; if($cat==1){print "selected='yes'";}print">1</option>
<option value='2'"; if($cat==2){print "selected='yes'";}print">2</option>
<option value='3'"; if($cat==3){print "selected='yes'";}print">3</option>
<option value='4'"; if($cat==4){print "selected='yes'";}print">4</option>
</select>
 for <input type='text' value='$q' name='q'>
<input type='submit' value='Go' />
</form></div></td></tr>
<tr>
</table>";

print "<BR>results here";
?>

2 个答案:

答案 0 :(得分:3)

你的div一开始就没有关闭。

<div style='padding-top: 10; font-family: arial; font-size: 14px;'

我重写了你的代码,使用它代码,更高效,更容易阅读/调试:

<table width='522' cellpadding='2' cellspacing='0' border='0'>
    <tr>
        <td valign='top' width='128'><img src='logo.gif' border='0'></td>
        <td valign='bottom'>
            <div style='padding-top: 10; font-family: arial; font-size: 14px;' >
                <form action='' method='GET'>
                    Search category
                    <select name='cat'>
                        <option value='1' <?php if($cat==1){echo "selected='yes'";} ?> >1</option>
                        <option value='2' <?php if($cat==2){echo "selected='yes'";} ?> >2</option>
                        <option value='3' <?php if($cat==3){echo "selected='yes'";} ?> >3</option>
                        <option value='4' <?php if($cat==4){echo "selected='yes'";} ?> >4</option>
                    </select>
                    for <input type='text' value='$q' name='q'>
                    <input type='submit' value='Go' />
                </form>
            </div>
        </td>
    </tr>
</table>
<BR>results here

答案 1 :(得分:1)

使用validator,输出的HTML中有错误。我希望Internet Explorer的错误恢复过程不会处理有关<form被破坏的代码(因为您尝试在另一个元素的start标记内启动表单元素)。