...

View Full Version : urlencode/decode question



mssteph
12-24-2010, 05:39 PM
I know very little about PHP so, I'm sorry and please bear with me.

I built a page that has a list of counties covering Maryland and Virginia. When the user clicks the city link, he's taken to a page that inserts the county name into the page. Here's the code:

index.php:



<a href="city.php?city=<?php echo urlencode("Anne Arundel County"); ?>">Anne Arundel County</a>


city.php:



Contact us in <?php echo urldecode($_GET['city']); ?> today!


The result on the page being, "Contact us in Anne Arundel County today!"

My question is, if I want to add the state name to the result page as well, how would I go about this? So that it would read:

"Contact us in Anne Arundel County today! We're fully licensed in all Maryland counties as well!"

Is there a way to do this, rather than having to create one template for Maryland counties, and another template for Virginia counties?

Thanks for any help. Merry Christmas!!

DJCMBear
12-24-2010, 05:45 PM
Couldn't you do this.


<a href="city.php?city=<?php echo urlencode("Anne Arundel County"); ?>&state=<?php echo urlencode('Maryland'); ?>">Anne Arundel County</a>

mssteph
12-24-2010, 06:00 PM
Couldn't you do this.


<a href="city.php?city=<?php echo urlencode("Anne Arundel County"); ?>&state=<?php echo urlencode('Maryland'); ?>">Anne Arundel County</a>


Thank you.

DJCMBear
12-24-2010, 06:25 PM
No problem, if you ever need anything else just post your question, i'll be happy to help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum