开发者

HTML Button doesn't work in IE, but other browsers fine

I am writing a small database viewer.. I have a link at the bottom as you can see sending an id to another page. This button works on every other browser except IE.

Any ideas?

If I click on it on IE, it does nothing.

    <?php
include_once('include/opendb.php');

$query = "SELECT id, rep, date, account, areacode, number, address1, address2, city, state, zip, fax, descmaker1, descmaker2, title, email, cvendor, cequipment, leaseexp1, leaseexp2, leaseexp3, leaseexp4, leaseexp5, leaseexp6, volume, notes FROM accounts";
$result = mysql_query($query);
$entrytotal = mysql_num_rows($result);

  echo '<div id="entrytotal">' . $entrytotal . ' Total Accounts</div>';

while($row = mysql_fetch_row($result)){
    $id = $row[0];
    $rep = $row[1];
    $date = $row[2];
    $account = $row[3];
    $areacode = $row[4];
    $number = $row[5];
    $address1 = $row[6];
    $address2 = $row[7];
    $city = $row[8];
    $descmaker1 = $row[12];
    $descmaker2 = $row[13];
    $title = $row[14];
    $email = $row[15];
    $cvendor = $row[16];
    $cequipment = $row[17];
    $leaseexp1 = $row[18];
    $leaseexp3 = $row[20];
    $volume = $row[24];

            echo '<tr>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $rep . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $date . '</b></font></td>';
            echo '<td width="120" align="middle">开发者_JAVA百科;<font color="black"><b>' . $account . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $address1 . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $city . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $descmaker1 . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $descmaker2 . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $title . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $cvendor . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $leaseexp1 . '</b></font></td>';
            echo '<td width="120" align="middle"><font color="black"><b>' . $leaseexp3 . '</b></font></td>';
            echo "<td width='120' align='middle'><a href='info.php?id=" . $id . "'><input style='font-family:Helvetica; width: 50px;' type='submit' value='Info'></a></td>";
            echo '</tr>';
}
   ?>


Just a few quick notes without testing it but:

  1. You can just style an anchor link to look like a button, no need to put a button inside an anchor tag.
  2. As to the previous point, if you are just trying to link to another page you don't need an input element. Just the link.
  3. If you indeed are trying to submit a form I don't see any <form> tags in your example.


I suggest you do this instead:

<input style='font-family:Helvetica; width: 50px;' type='button' value='Info' onclick="location.href='info.php?id=<?php echo $id; ?>'">

EDIT

Note: you need to remove the link tag surrounding the button.


You don't really need a button without a form. you could just use a link.

echo "<td width='120' align='middle'>
   <a href='info.php?id=" . $id . "'>Info</a>
</td>";

and if you'd like to style it, just use a span like so

  <td width='120' align='middle'>
    <a href='info.php?id=" . $id . "'>
    <span style='font-family:Helvetica; width: 50px; border:1px solid #000; padding:5px; background-color:#ccc;'>Info</span>
    </a>
  </td>


The other answers are correct.

Here's some HTML to help:

<form method="post"><!-- or method="get" if you're not changing anything -->
<!-- other hidden input data here -->
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="submit" value="Info">
</form>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜