Echo Statement with href

Experts,
How do I structure this echo statement.  I have attempted this several different ways and keep getting an error...

echo '<a href="http://www.mystore.net/store/index.php?cat="'.$data['id'].'">'.$data['name'].';

Thanks for your help!
echo '<a href="http://www.mystore.net/store/index.php?cat="'.$data['id'].'">'.$data['name'].';

Open in new window

rlb1Asked:
Who is Participating?
 
gamebitsCommented:
sorry missing the closing tag

echo "<a href=\"http://www.mystore.net/store/index.php?cat=\"".$data['id']."\">"".$data['name'].""</a>";
0
 
gamebitsCommented:
echo "<a href=\"http://www.mystore.net/store/index.php?cat=\"".$data['id']."\">"".$data['name']."";
0
 
john-formbyCommented:
Hi,

You just need to remove the last .' from the line.  It should be like this:

echo '<a href="http://www.mystore.net/store/index.php?cat="'.$data['id'].'">'.$data['name'];

Hope this helps,

John
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
john-formbyCommented:
Oops, misread the code, gamebits code is correct
0
 
kumaranmcaCommented:
try my code...to resolve your problem..
<?php
$data['id']=1;
$data["name"]='test';
echo '<a href=http://www.mystore.net/store/index.php?cat='.$data['id'].'>'.$data["name"].'</a>';

?>

Open in new window

0
 
Chris StanyonCommented:
This will do what you're after.



printf('<a href="http://www.mystore.net/store/index.php?cat=%s">%s</a>',$data['id'], $data['name']);

Open in new window

0
 
Marco GasiFreelancerCommented:
This will work:

echo "<a href='http://www.mystore.net/store/index.php?cat='".$data['id'].">".$data['name']. "</a>";

Regards
0
 
rlb1Author Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.