November 6, 20169 yr I'm currently learning PHP to build search box functionality. echo "Page: ".$rs['sitepage']; At the moment, I can echo 'sitepage' to bring up the string (url) that is written in the sitepage column of a table. How can I make the url clickable, so the user can click on it? Thanks for any help.
November 6, 20169 yr Author This seems to work: echo "<a href='".$rs['sitepage']."'>Link</a>"; Although, I prefer it to just echo the clickable / whole url straight off the bat, and not bother showing the `Link'. Thanks for any help.
November 6, 20169 yr The browser can't convert the URL to a link automatically, you'll have to echo the var in the HREF attribute, and between the <a> tags for it to display the URL and link to it. <?php echo "<a href=\"".$rs['sitepage']."\">".$rs['sitepage']."</a>; ?> Edited November 6, 20169 yr by jpeters8889
November 7, 20169 yr Author The browser can't convert the URL to a link automatically, you'll have to echo the var in the HREF attribute, and between the <a> tags for it to display the URL and link to it. <?php echo "<a href=\"".$rs['sitepage']."\">".$rs['sitepage']."</a>; ?> Thank you very much, jpeters8889. I will try to work with that code. When I paste it into my PHP with the other echo statements, (with or without the <?php ?>) I'm getting a bunch of other coding errors (not your code though) for the first time coming up in Dreamweaver, including in the HTML part of the .php page, too. I'm a little out of my depth, but I'll work with your code. Thank you. I much appreciate this. Edit: echo "<a href=\"".$rs['sitepage']."\">".$rs['sitepage']."</a>"; I added " at the end and it works! Thank you very much for your help. Edited November 7, 20169 yr by Grant Barker
November 7, 20169 yr Author Thanks NOCK. That's good to know. It's a slow process, but it's enjoyable learning PHP. Cheers.
November 7, 20169 yr Thank you very much, jpeters8889. I will try to work with that code. When I paste it into my PHP with the other echo statements, (with or without the <?php ?>) I'm getting a bunch of other coding errors (not your code though) for the first time coming up in Dreamweaver, including in the HTML part of the .php page, too. I'm a little out of my depth, but I'll work with your code. Thank you. I much appreciate this. Edit: echo "<a href=\"".$rs['sitepage']."\">".$rs['sitepage']."</a>"; I added " at the end and it works! Thank you very much for your help. My mistake, I wrote it in a rush and forgot the closing " at the end, glad you sorted it though
Create an account or sign in to comment