Page 1 of 1

Putting Username in HTML & PHP after logging in....

Posted: Tue Apr 22, 2008 1:13 am
by latoyale
Good day,

I have a form. After a user logs in correctly, I want a welcome "username" to come up. How can I get this done if my page uses HTML and PHP? Unfortunately most of the tutorials I've seen online use only php to get this done. My code is:

<?php
session_start();
if(!session_is_registered(myusername)){
header("location:index.html");
}
$username = $_POST["username"];
// Check if session is not registered , redirect back to main page.
// Put this code in first line of web page.

?>
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Ask Slicky</title>

<link href="images/styler.css" rel="stylesheet" type="text/css">

<script type="text/javascript">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features);

}

//-->

</script>

<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>

<body><script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-3668065-4";
urchinTracker();
</script>

<br>

Welcome "$myusername",<br>

<strong>Please Enter Your Description
:</strong><br>

</body>

</html>

Re: Putting Username in HTML & PHP after logging in....

Posted: Tue Apr 22, 2008 1:18 am
by markusn00b
Use an echo statement (you can use them wherever you need to inside html).

Code: Select all

 
<h1><?php echo "hello $username";?></h1>