2

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"><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>';
}
   ?>
JD Audi
  • 1,067
  • 6
  • 18
  • 37

4 Answers4

2

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.

Kevin Peno
  • 9,107
  • 1
  • 33
  • 56
boug
  • 1,859
  • 1
  • 13
  • 13
2

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.
jaywon
  • 8,164
  • 10
  • 39
  • 47
  • I'd remove the note about self closing input tag. If the document is HTML then it is indeed valid. – Kevin Peno May 11 '11 at 23:05
  • @Kevin - i see you're point, but promoting proper formatting is a good thing imho. It may be valid HTML but it is bad practice(and not valid XHTML). – jaywon May 11 '11 at 23:08
  • It's not bad practice and its not invalid. It is ok if you want to promote HTML via XML serialization, but you cannot throw around validity without knowing if the user is using HTML or XHTML. – Kevin Peno May 11 '11 at 23:10
  • well that's certainly 1 opinion. If you ever did have a need for being XHTML compliant, why not be proactive when it simply comes down to adding a closing slash? It's certainly not a bad suggestion and undeserving of a downvote. – jaywon May 11 '11 at 23:15
  • First, I didn't downvote you. I upvoted and then removed the vote based on your reply to me. Second, validity per standard is not opinion. You cannot tell someone using HTML that it is invalid because you want them to use XHTML. You can't say its invalid in the first place because it was never stated which standard they were following! Let's not take this so personally ;) – Kevin Peno May 11 '11 at 23:18
  • ok, just did a bit of research on this one, and i stand corrected :P learn something new every day. – jaywon May 11 '11 at 23:29
  • @jaywon, yay! Glad we could come to an agreement :D – Kevin Peno May 11 '11 at 23:31
  • good post for anyone else interested in our argument: http://stackoverflow.com/questions/3201870/are-self-closing-input-tags-valid-in-html-4 – jaywon May 11 '11 at 23:32
1

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>
Ian Fleeton
  • 1,157
  • 8
  • 14
1

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>
robx
  • 3,093
  • 2
  • 26
  • 29