Jump to content

String Problems


ntwiles

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.