Very new to all of this and having some issues using a line of code.
All i am trying to do is have my html file have a require statement that pulls a php file however it is not working. Please help.
<?php
require 'localhost/php/loginscreen.php';
?>
"All i am trying to do is have my html file have a require statement that pulls a php file however it is not working".
That to me suggests that you're using an .html
file as a base file to pull in an .php
file.
Unless you've instructed your server to treat .html
files as PHP, you would need to rename that file to a .php
extension.
Edit. Consult the following Q&A on Stack on how to do this:
Your syntax for require 'localhost/php/loginscreen.php';
is incorrect.
You would need to either use a full system path: (as an example, replace that with your system path).
require '/var/usr/public/php/loginscreen.php';
or a relative path:
require 'php/loginscreen.php';
and using http://localhost
rather than a possible file:///
url in the browser.
"Strange as there is no error. as i refresh my html file nothing happens."
Had you viewed your HTML source, you would have most likely have seen code, rather than parsed (PHP) directives. That would have been the reason why you did not see any errors, least not php-wise.