开发者

(php) How do make my submit button work in ie

My form works in firefox but not ie. I've tried using a hidden text field (fail)... I tried using an image instead of a submit button (fail)... are there any other solutions? Here is my form:

<?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";
?>


Your div is not closed for a start.

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

I've rewritten your code, use this instead ,much more efficient and easier to read / debug:

<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


Use a validator, the outputted HTML has errors in it. I expect Internet Explorer's error recovery process doesn't deal with the code about <form being broken (since you are trying to start the form element inside the start tag for another element).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜