Get Data from Session_Register

Hello,

I have this working form which interacts with a MySQL database.
I also have a login form to project the application. I’m using PHP session and session_register

What I want to do is to get the username from the session_register and put it in an input field called “admin”. The input field is readonly so the user cannot change it but the data should be saved to the database when the user hits the “save changes” button.

Would that be possible with a json form?
Please help me out.

{type:"input", name:"admin", bind:"admin", label:"Admin", required:true, validate:"NotEmpty"},

Thanks in advanced.

Hi

version 1)
get field from mysql and use value attribute in a form

version 2)
init form and use myForm.load() to load values from mysql

which better for you?

Hello Andrei,

how do I do it?


{type:"input", value:"<?php echo $_SESSION['admin']; ?>" name:"admin", bind:"admin", label:"Admin", required:true, validate:"NotEmpty"},

yes, this is also an option.

Hi Andrei,

is not working as expected.

As value I get just the php value="<?php echo $_SESSION['admin']; ?>" code returned.

<?php
$_SESSION['admin'] = $_GET['admin'];
?>

{type:"input", value:"<?php echo $_SESSION['admin']; ?>" name:"admin", bind:"admin", label:"Admin", required:true, validate:"NotEmpty"},

well,

please provide completed demo or direct link, including all corresponding js/css files

do you have session_start() somewhere?