Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

SQL fill a form?

  • 05-04-2009 08:26PM
    #1
    Registered Users, Registered Users 2 Posts: 7,994 ✭✭✭


    Hi Folks,

    I'm currently developing for a friend. We need a form to fill automatically when a user logs in. For instances Mr.X log's in, and when he goes to the "Contact Us" form, his email that he signed up is already in the form. Its part of a verification process so that a user is tied to certain details.

    Many Thanks!

    ironclaw


Comments

  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Why don't you just set the initial/default value of the HTML tag. Do a simple DB look up and get the current user's email and set it. Or am I reading this wrong?


  • Registered Users, Registered Users 2 Posts: 7,994 ✭✭✭ironclaw


    Yeah, exactly. Was doing the calls wrong. I'll keep tinkering. Thanks for the help.


  • Registered Users, Registered Users 2 Posts: 2,592 ✭✭✭tommycahir


    If you are developing in PHP then you could use sessions, when the member log's in the email variable in the session is set. Then retrieve the value and use it when they go to the page with the form on it

    setting the session would be something like this code:
    //Login Successful
    session_regenerate_id();
    $member = mysql_fetch_assoc($result);
    $_SESSION['SESS_MEMBER_ID'] = $member['member_id'];
    $_SESSION['SESS_FIRST_NAME'] = $member['firstname'];
    $_SESSION['SESS_EMAIL'] = $member['email'];
    session_write_close();
    


Advertisement