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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.