|
Posted by news.tpg.com.au on 05/28/05 13:26
Figures on second attempt this actually worked.
For anyone who is interested, I used the cookie for the username for several
parts of the site to check for a valid login and initiated a session to hold
other user information such as name, e-mail and so on.
I chose to keep the username in a cookie rather than a session to hold the
username for a longer amount of time. (i.e. if the person returned to the
same site on the same day)
I figured that it would make sense for people to update their details when
they first logged on or at least during an initial browser session where the
session had not been removed.
Failing that, they can always
(a) log in again which will create a new session based on their stored
details.
(b) 'deal with it' and enter their details from scratch - less user friendly
but still functional.
And for those of you reading through dozens of lines of code today and need
a break...
*does php sound like a drug to anyone else?*
*mmm php*
*when a problem comes along you must php it, *whip noise*, php it good
You can tell I'm not in the mood for any more coding 2nite...
"news.tpg.com.au" <carol500@tpg.com.au> wrote in message
news:4297f7fb@dnews.tpgi.com.au...
> This is probably quite easy but I think I'm getting the syntax wrong
> somewhere.
>
> I have a form to update user details and it would be NICE if I could
obtain
> those user details from the database and place it directly into the form
on
> the condition that a cookie is set for the user.
>
> Originally I had an HTML form not even considering the possibility. Set up
> similar to the below.
>
> <table>
> <tr>
> <td>Your First Name: </td>
> <td><input name="First" type="text" id="First">
> example: Joe</td>
> </tr>
> </table>
>
> So I tried renaming a couple of files, this one to a PHP and tried putting
> some PHP in there for the value field of input like so:
>
> <table>
> <tr>
> <td>Your First Name: </td>
> <td><input name="First" type="text" id="First" value="
>
> <?php
> if( isset($_COOKIE[User]) ) echo '$_COOKIE[User]';
> ?>
>
> ">
> example: Joe</td>
> </tr>
> </table>
>
> The input box field fills in but with an error rather than the value of
the
> username.
> Any ideas anyone?
>
>
Navigation:
[Reply to this message]
|