Reputation: 9
I'm trying to pass a variable in a back button, I'm trying to pass back the value from the previous form. Is the format I use correct to pass a variable inside a button in PHP?
<?php
if (isset($_GET['id']))
{
$id = $_GET['id'];
strval($id);
echo "<a name='btn_edit' href=\"view_order.php?id='$id'\">Back</a>";
}
?>
is this the correct format
Upvotes: 1
Views: 34
Reputation: 823
Try this:
echo "<a name='btn_edit' href=\"view_order.php?id={$id}\">Back</a>";
Upvotes: 1