I have a variable called $link = 'Post an Openning' for example sent through the URL.. like so: (i use / instead of & and ?)
http://something.com/dev/list.php/postjob/Post%20an%20Openning
on this page, i print(" $link "); and its fine it will give me Post and Openning.
But if i need to include it in a URL again.. like
<a href=http://something.com/dev/listagain.php/postjob/$link>
how do i do this..?? what is the syntax for including a variable in the href
Try this:
<a href=http://something.com/dev/listagain.php/postjob/<?php echo($link) ?>>
Obivously the file holding the above should a php file.
Regards
Or you could make the whole line php and echo it.
<?php echo "<a href=http://something.com/dev/listagain.php/postjob/".$link.">";
Either way should work. It didn't work because you had php code outside of a php tag.
I would bet you need to encode the variable...
<? echo '<a href=http://something.com/dev/listagain.php/postjob/' .urlencode($link). '>'; ?>
not in all cases do you need to urlencode/urldecode
however it is a good habit to get into and to keep your code portable
I understand that, but from my experience, some browsers ONLY auto encode urls that are typed into the goto bar, hrefs arent always done...