Jump to content

[SOLVED] PHP Get with Variable


Glenugie

Recommended Posts

I have a page,, which contains on it a link, this link is being generated through a get variable, but I am trying to have it as a variable. I don't think my explanation is very clear, here's the code:

80- <a href='combat.php?area=<?$area?>'>Again</a>

 

The variable $area has been echoed and it does have the correct value, but the link ignores it, so it just links to:

combat.php?area=

I have a feeling the problem is because I am putting PHP tags in the middle of the link.

 

I have tried putting the whole link in php, and I've tried putting the <a href..../a>

in the tags as well, but it doesn't seem to make any difference

 

What would I have to change to fix this?

 

Thanks again People :)

 

~Glenugie~

Link to comment
https://forums.phpfreaks.com/topic/139326-solved-php-get-with-variable/
Share on other sites

80- <a href='combat.php?area=<?php echo $area; ?>'>Again</a>

 

I believe that is the correct way to echo it out, the other way would have been <?= but if short tags are turned off it would not work.

 

If that does not work, paste more code please.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.