Am trying to show the value of the $login_session in my welcome page but it doesn't show. Any help on that
Welcome.html:
<?php
include("session.php");
?>
<html>
<h1>Welcome <?php echo $login_session; ?></h1>
</html>
Session.php
:
<?php
include ("db_connection.php"); session_start();
$user_check = $_SESSION['login_user'];
$ses_sql = mysqli_query($conn,"select First_name from User where Email = '$user_check' ");
$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);
$login_session = $row['First_name']; ?>
welcome.html ? try executing it as .php or You can't execute php in html file, unless you instruct Apache to treat .html files as PHP
to do this , Create a .htaccess file at the root of your website and add this line:
[Apache2 @ Ubuntu/Debian: use this directive]
AddType application/x-httpd-php .html .htm
If your are running PHP as CGI (probably not the case), you should write instead:
AddHandler application/x-httpd-php .html .htm
Also try with localhost / server !
Is your webserver enabled to execute php in html files?
If the Browser call on Welcome.html returns the plain php code this is the reason why. Try renaming the welcome.html file into welcome.php update the call in your browser.
Bro, change the file extension in PHP and run it through any server or localhost.