将PHP GET发送到另一个不起作用的页面

I am trying to send a simple get to another page, and it doesn't send the correct info. I am pulling my id from mySQL, and its turning into a variable, which is $id. I am echoing a button so a user can click on the button and learn more about the item.

Here is my echo.

    echo "<td width='120' align='middle'><a href='info.php?id='" . $id . "'><input              
    class='btn' style='font-family:Helvetica' type='submit' value='Info'></a></td>";

If I simply say echo $id; it shows '30' which it's supposed to. But pushing it using the echo above doesn't work. So I tried adding a hidden text field and submitting that. If I do that, it doesn't add on the id=, it just puts in the URL info.php?30= instead of info.php?id=30

Any ideas?

You have an extra ' in the href parameter which may be causing problems. Change it to:

<a href='info.php?id=" . $id . "'>
                     ^--- extra ' was here

You have an unnecessary single quote after id=. The browser probably tries to automatically fix the error and removes the id in the process.

Try this

echo "<td width='120' align='middle'><a href='info.php?id=" . $id . "'><input
class='btn' style='font-family:Helvetica' type='submit' value='Info'></a></td>";

Remove the single-quote ' after id:

echo "<td width='120' align='middle'><a href='info.php?id=" . $id . "'><input class='btn' style='font-family:Helvetica' type='submit' value='Info'></a></td>";