Forums

PHP

This topic is locked

session variable question

Posted 19 Oct 2007 20:34:23
1
has voted
19 Oct 2007 20:34:23 Freida Goossen posted:
Using dreamweaver 8, I am passing the session variable of username from page to page on my website. I would like to put it as a hidden field in a form, but I can't get the code right. Can someone help with the code that would put the variable in the form as a value in a field to be transferred to a database.

Thanks anyone who can help.

Replies

Replied 20 Oct 2007 13:24:08
20 Oct 2007 13:24:08 Alan C replied:
HI
something like this . . . .


<pre id=code><font face=courier size=2 id=code> &lt;input type="hidden" name="usename" value="&lt;?php echo $_SESSION['username']; ?&gt; /&gt;</font id=code></pre id=code>

that should put it into the field, you could also just use the session variable without passing it through the form, that way it does not get exposed in the code that can be viewed

Reply to this topic