ntwiles Posted August 31, 2010 Share Posted August 31, 2010 It seems like every new language I learn, I get this exact same issue. I want to make a clickable link that will go to "viewpost?postid=" and then add the value of a variable. The variable is an array. Here's what I'm trying. I'm not really sure why it doesn't work: <?php $poststr = "<a href=\'viewpost.php?"+$postid[$num]+"\'>View This Post</a>"; echo $poststr; ?> $postid[$num] in this example should be an integer. But what it outputs is really weird. It's not "View This Post" as a link, which is what I want. It just outputs the value of the variable $postid[$num] with no link. Can someone tell me what my problem is? Link to comment https://forums.phpfreaks.com/topic/212135-string-problems/ Share on other sites More sharing options...
Alex Posted August 31, 2010 Share Posted August 31, 2010 In PHP you use . to concatenate strings, not +. Link to comment https://forums.phpfreaks.com/topic/212135-string-problems/#findComment-1105449 Share on other sites More sharing options...
ntwiles Posted August 31, 2010 Author Share Posted August 31, 2010 Oh wow haha I really over thought that. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/212135-string-problems/#findComment-1105450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.