I am trying to insert a Session Variable $_SESSION[‘MM_loginName’] into a table via a form.
I know the Session Variable works on the new page by using:
<?php
echo "MM_loginName = {$_SESSION['MM_loginName']} <br>\n";
?>
I have read that this might work (if register globals is off):
<input type="hidden" name="loginName" value="<?php echo $_SESSION["MM_loginName"]; ?>" />
but it doesn’t, because I think register globals has been DEPRECATED.
This is supposed to work:
<input type="hidden" name="username" value="<?php echo "$myusername"; ?>" />
but i don’t know how to rewrite the code to “$loginName”
Help,
Here is my table/form structure:
<tr>
<td width="99"></td>
<td width="391"><input type="hidden" name="loginName" id="loginName" value= "????/></td>
</tr>
Thanks
Michael
I think your first one isn’t working because references to array variable values within strings aren’t evaluated within
echostatements. Assuming that you want to put the username, which is stored in the session, into the value field of your form, I would do something like: