Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

SQL fill a form?

Options
  • 05-04-2009 8:26pm
    #1
    Registered Users Posts: 8,004 ✭✭✭


    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 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 Posts: 8,004 ✭✭✭ironclaw


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


  • Registered Users Posts: 2,593 ✭✭✭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