Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP file is printing everything after echo command

Tags:

html

php

I'm trying to build my first website. I have a domain name and am building it on my laptop before uploading it to my host. The website is mostly focused around searching a database of family tree information.

I have created a basic HTML file which seems to be working ok. I have a search button linked to a PHP file. Ideally when someone used the button without putting in parameters it should reply with an error message that says "search term is missing" but instead it shows all the code for the PHP file. I've never done anything like this before so am more than a little confused.

like image 550
Ed Fordham Avatar asked Dec 02 '25 05:12

Ed Fordham


2 Answers

Welcome to the web development world !;)

the php file must have a .php extensions, and should begin with <?php and end with ?>

you probably forgot one of those :)

like image 153
Mostafa Berg Avatar answered Dec 03 '25 19:12

Mostafa Berg


Your browser will not understand php by itself, on a given web server there's a number of layers for compiling PHP etc. Try XAMPP, you'll have it up and running in no time and you can see your PHP at work by simply looking up localhost with your browser.

like image 25
aumbadgah Avatar answered Dec 03 '25 17:12

aumbadgah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!