prepopulating text fields

Discussion in 'Customization & add-ons' started by pancakeunicorn, May 22, 2009.

  1. pancakeunicorn

    pancakeunicorn New Member

    Joined:
    Apr 5, 2007
    Messages:
    6
    I'm using amember for my e-learning website. My students (subscribers) send written responses to questions using html input forms. The current set up requires that they fill in the "name" and "email" fields with each submission so that I can identify them when I receive the email. I would like to automatically prepopulate those fields using session variables, but I can't seem to find the right code. I realize it must be a simple solution, but I'm not much of a coder, so if anybody could help with this, I would be very grateful.

    Thanks.
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
  3. pancakeunicorn

    pancakeunicorn New Member

    Joined:
    Apr 5, 2007
    Messages:
    6
    Thanks for the reply, but I was actually having trouble getting the variables to appear within html forms properly. Anyway, I figured it out. For others who may benefit, here's the code I used. It must be inserted within the opening <input> tag:

    value="<?php echo $_SESSION['_amember_user']['name_f']; ?>"

    This populates the field with the user's first name, but of course, the code works for any variable.

Share This Page