help - setting input box value to variable
Posted: Tue Mar 02, 2010 6:33 pm
Hi,
I have a set of html and php pages which requires a user to login with a valid username and password before they are brought to a data entry screen. Once logged in a session is registered for the data entry page, and the following code is at the begining of the page:
What I would like to do is use the 'myusername' variable to populate the value of an input box later on in the page within a form that is posted to an SQL database. Doing this will allow me to track who is entering the data. I had the following code working under a webhost that I was testing, but when I switched hosts, the same code no longer works. I'm hoping someone can help as I'm pretty new to all of this.
The code that did work is:
Any help that could be provided would be greatly appreciated.
Thanks very much,
Kev
I have a set of html and php pages which requires a user to login with a valid username and password before they are brought to a data entry screen. Once logged in a session is registered for the data entry page, and the following code is at the begining of the page:
Code: Select all
<?php
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.html");
}
?>
The code that did work is:
Code: Select all
<label for ="loginname" style = "font-weight: bold;"> Currently logged in as: </label>
<input type = "text" name = "loginname" value = "<?php echo $myusername?>" style="background-color:transparent; border:0px solid white; color:#0000FF; font-weight:bold;" readonly = "readonly">
Thanks very much,
Kev