| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Dec 2006
Posts: 236
![]() | |
| |
| | #3 (permalink) | ||||
| NamePros Member Join Date: Dec 2006 Location: London
Posts: 101
![]() |
????: NamePros.com http://www.namepros.com/programming/483205-passing-php-variables.html Code: $var1 = 'Free+Online+Games'; <a href="script2.php?q=<? echo urlencode($var1);?>" <? echo "$var1";?></a>
__________________ ejbrown.net - XHTML/CSS/AJAX/PHP/mySQL development | ||||
| |
| | #4 (permalink) |
| NamePros Member Join Date: Sep 2006
Posts: 99
![]() ![]() | Everyone is missing the closing tag (">") on the original link after the ending quote. It is also a good practice to use full opening php tags, not shorthand. Most configurations support these shorthands, but there are still some that do not. You can also use <?php= Code: <?php $var1 = 'Free+Online+Games'; ?> <a href="script2.php?q=<?php=urlencode($var1)?>"> <?php=$var1?></a> When echoing just a variable, don't put it inside of " " Code: echo $var; Code: echo "$var"; ????: NamePros.com http://www.namepros.com/showthread.php?t=483205 I really enjoyed This Article that I found using StumbleUpon about php efficiency. Bruce |
| |