How to add a href link in PHP?
href, html, php
Solution
Looks like you missed a few closing tags and you nshould have "http://" on the front of an external URL. Also, you should move your styles to external style sheets instead of using inline styles.
.box{
float:right;
}
.box a img{
vertical-align: middle;
border: 0px;
}
<div class="box">
<a href="<?php echo "http://www.someotherwebsite.com"; ?>">
<img src="<?php echo url::file_loc('img'); ?>media/img/twitter.png" alt="Image Decription">
</a>
</div>
As noted in other comments, it may be easier to use straight HTML, depending on your exact setup.
<div class="box">
<a href="http://www.someotherwebsite.com">
<img src="file_location/media/img/twitter.png" alt="Image Decription">
</a>
</div>
Problem
I'm very new to PHP and trying to make a site update on the fly. I need to update the code so that the link will direct to www.otherwebsite.com. Currently the link directs to the current websites RSS feed. Here is the original div: ``` <div style="float:right;"> <a href="<?php echo url::site(); ?>feed/"><img src="<?php echo url::file_loc('img'); ?>media/img/icon-feed.png" style="vertical-align: middle;" border="0"></a> ``` I need to alter this to point to www.someotherwebsite.com. It looked simple enough. Here is what I tried: ``` <div style="float:right;"> <a href="<?php echo www.someotherwebsite.com"><img src="<?php echo url::file_loc('img'); ?>media/img/twitter.png" style="vertical-align: middle;" border="0"></a> ``` That never worked, instead I received an error message concerning the line where I had made this edit. How would I update this?