Skip to content

Why does my button not pass the Order ID onto another page?

I have a page called order_page.php and it has a hyperlink that should pass the Order ID of a particular order to another page called edit.php.

I looked up some tutorials on youtube but it’s still not passing what I want.

This is what I’ve tried.

echo "<td class='total'></td><td class='total' id='total2'>TOTAL:</td><td class='total' id='total2'>".$float_total."</td><td> <a href='edit.php'?edit=$row[orderid]>Edit</a></td>";

And then this is the edit.php code


            $oid = $_GET['edit'];
            $res = mysql_query("SELECT * FROM orderdb");
            $rowww= mysql_fetch_array($res);

It doesn’t seem to pass an orderid. If you want I can show the full source code.



Your problem appears to have arisen from losing track of all those quotation marks. Consider not using echo() for the whole line because it doesn’t seem to be serving any advantage in your case. In this way you can then use ascsoftw’s answer.

In addition, take a look at your href=. The part containing your query string is outside of the single quotes when it should be inside.

Given these mistakes it is also highly advisable that you don’t immediately get into the db side of things without first testing what your GET returns at the destination script.

1 People found this is helpful