Newbie Problem with php Code appearing in webpage

html
php

#1

Hi. I need your help please.

I’m brand new to using SQLi and PHP and am working on an exercise for uni. I have a bug that is causing some of the code to appear at the top of the webpage. For the life of me I can’t figure out what I’ve done wrong.

Any idea?


#2

While I’m not entirely sure what’s happening, can you try replacing line 33 with the following:

echo "<a href=\"/\">Back Home</a>";

This will allow you to use double quotes inside an already double-quoted string by telling PHP to escape the quotes from being processed as the end of the string.


#3

Hi Danny,

Thanks for responding. You gave me new life and I found the problem! There was a space in <?php. The hours (and hours and hours :frowning: ) I have wasted on this!

Weirdly I know that href actually works. I noticed though that the one in the html looks like this: echo '<a href="/">&lsaquo; Back Home</a>';so I’ve updated the line for consistency.

Really appreciate you helping a bumbly (newbie) out!! :sunny: