Passing variables through URL

Ask about a PHP problem here.
Post Reply
User avatar
DomC
Posts: 91
Joined: Mon Jul 18, 2011 1:58 pm

Passing variables through URL

Post by DomC »

Hi,
For some reason this code:
<a href="managecomments.php?delete=<?php $stat['id'] ?>">
When clicked on goes to "managecomments.php?delete=" rather than including the id, for example "managecomments.php?delete=1"
Do you know why this is occurring?

Thanks for any help you can give!
Dom

P.s. Sorry if this is in the wrong section - I wasn't sure
I can't think of anything witty to put here!

Check out some of my projects on GitHub: https://github.com/DomTC
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: Passing variables through URL

Post by bowersbros »

you need to echo that variable.
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
DomC
Posts: 91
Joined: Mon Jul 18, 2011 1:58 pm

Re: Passing variables through URL

Post by DomC »

Silly error on my part :(
Thanks a lot for your help!
I can't think of anything witty to put here!

Check out some of my projects on GitHub: https://github.com/DomTC
JelvinJS7
Posts: 341
Joined: Thu May 12, 2011 8:40 pm

Re: Passing variables through URL

Post by JelvinJS7 »

Echo it out, and put a ; after $stat['id']
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Passing variables through URL

Post by jacek »

JelvinJS7 wrote:Echo it out, and put a ; after $stat['id']
The last ; before the ?> is optional, but yeah it should be put there for consistency :)
Image
Post Reply