I want to send a value using the get method. The code is something like this
<td><a href="cart-remove.php?id={$row['id']}" class="remove_item_link"> Remove</a></td>
This value i want to send is stored in $row['id'].This is not my code its from my instructor (very popular website with around 30k people having enrolled in the course so far but i can't name them here), see this
but if i type exactly like he/she did i will get this error.
Found this answer on stackoverflow (from 2013). But when i use it like this
<?php
$id=$_GET['id'];
echo "hey".$id;
I get a output like this hey{$row['id']}
I have tried this but it doesn't work either
<td><a href="cart-remove.php?id={$row[\'id\']}" class="remove_item_link"> Remove</a></td>
How do i get this value in the cart-remove.php page? I know answers some from this question work but i am trying to keep my code similar to my instructors code as he is gonna rate the project. Also, this answer(mentioned above) was from the same thread.
At the request of the author of the topic.
All the plain HTML in your code will be ignored by the PHP compiler and passed to the web browser unchanged, so you need to open the <?php
handler.
<td><a href="cart-remove.php?id=<?=$row['id']?>" class="remove_item_link"> Remove</a></td>
and your instructor probably meant the following conclusion:
<?php echo "<td><a href='cart-remove.php?id={$row['id']}' class='remove_item_link'> Remove</a></td>"; ?>
but, this will only work if the text is already in the php handler