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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gamebitsCommented:
echo "<a href=\"http://www.mystore.net/store/index.php?cat=\"".$data['id']."\">"".$data['name']."";
0
gamebitsCommented:
sorry missing the closing tag

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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 StanyonWebDevCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.