Jump to content

Search the Community

Showing results for tags 'php form fields member login'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I have been exploring a PHP login form. It's pretty simple for the most part and I like it. I have had a lot of trouble trying to find out how to add additional fields to the form to store additional information about a user in the database such as First Name, Last Name, etc. And more recently I have been working on form integration so when a user is logged into their account and wants to submit a form, the PHP will grab their information from their account and add it to the form so they don't have to. Example: With a contact form I have added a hidden "Username" field. If the user is logged in, it grabs their username from their session and includes it in the email, if the user is not logged in or has no account, it simply adds a message to that spot on the email that basically says "Non-Member or not logged in". I want to do something similar with the email. If the user is logged in, I want the email field to grab their email - which I got it to do, but I wanted to take it a step further and if they are a user, it not only grabs their email but makes the email field hidden (like the username) but if they are not a member or not logged in, it shows them an email form to type in. I got the PHP to grab the email & hide the form when logged in but the form will not submit. When logged out, it shows the email field and everything submits fine. This is the code I came up with and I'm not sure how I could correct it to allow the form to submit: <h1>Email Us</h1> <form name="contactform1" method="post" action="send_contact_email.php" border="0"><fieldset> <p><label for="first_name">First Name *</label><br /> <input name="first_name" maxlength="50" size="25" type="text" /></p> <input type="hidden" name="user_name" maxlength="50" value=" <?php if($session->logged_in){ echo $session->userinfo['username']; }else{ echo "Non-Member or not logged in"; } ?>"> <p><label for="last_name">Last Name </label><br /> <input name="last_name" maxlength="50" size="25" type="text" /></p> <p> <?php if($session->logged_in){ ?> <input type="hidden" name="email" maxlength="50" size="25" value=" <?php echo $session->userinfo['email']; ?>" DISABLED> <?php } else { ?> <label for="email">Email Address *</label><br /><input type="text" name="email" maxlength="50" size="25" value=""> <?php } ?> </p> <p><label for="location">Location</label><br /> <input name="location" maxlength="80" size="25" type="text" /></p> <p><label for="comments">Message *</label><br /> <textarea name="comments" wrap="soft" rows="2" cols="50" type="textarea"></textarea></p> <p><input value="Submit" type="submit" /> <input value="Clear" type="reset" /></p> </fieldset></form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.