dannybrazil Posted March 30, 2008 Share Posted March 30, 2008 hello i want to pass variables from page to page and i can get it to show first link : <?php $city_name=$_GET['city']; echo '<a href="http://www.brasilwebdesign.com/classifieds/addform.php?city=$city_name">'."add form".'</a>'; ?> when im coding " echo $city_name; im getting the city name from the last page (www.....php?city=abcd) OK but it doesnt padd the city name in this link . in the next page it writes me as the city name " $city_name" instead of "abcd" any help ? Link to comment https://forums.phpfreaks.com/topic/98674-php-passing-variables/ Share on other sites More sharing options...
BlueSkyIS Posted March 30, 2008 Share Posted March 30, 2008 i suggest switching your single- and double-quotes. echo "<a href='http://www.brasilwebdesign.com/classifieds/addform.php?city=$city_name'>add form</a>"; Link to comment https://forums.phpfreaks.com/topic/98674-php-passing-variables/#findComment-504993 Share on other sites More sharing options...
dannybrazil Posted March 30, 2008 Author Share Posted March 30, 2008 10x how can is echo something like that $category="Apt's/Houses for Rent"; when im echoing you see only "Apt" its thinking that the " ' " is the end of the sentense how can i print it as it is ? Link to comment https://forums.phpfreaks.com/topic/98674-php-passing-variables/#findComment-505036 Share on other sites More sharing options...
BlueSkyIS Posted March 30, 2008 Share Posted March 30, 2008 where are you echoing it? in a form field? if so, you'll probably want to use htmlspecialchars(): $category = "Apt's/Houses for Rent"; // put it in a text field: echo "<INPUT TYPE='text' NAME='category' VALUE='".htmlspecialchars($category, ENT_QUOTES)."'>"; Link to comment https://forums.phpfreaks.com/topic/98674-php-passing-variables/#findComment-505046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.