How To Output Registration Form Data To The Current Page And Another Page?
Solution 1:
Maybe I'm not understanding the question. You have a script, register_success.php. If you want to display the information on profile.php after successful registration, just change the location to profile.php instead of register_success.php. Then if there is an error, it will continue to load the form.php and if there isn't, it will go to profile.php. No?
Solution 2:
Data Persistence
HTTP is a stateless protocol so it will not remember information across different requests. In order to display the login information, you will need to persist this information. The INSERT INTO statement that you have does that already so all you need to do on your profile page is to retrieve the information from your database and display it using a SELECT SQL statement.
Authentication
You will also need to know which user record to retrive from your database. This is usually done by asking your user for credentials (e.g. his email address and his password). Based on this, you can verify that there is a user with these credentials and then retrieve the appropriate data. You may want to try a PHP login system tutorial such as this one: http://www.phpeasystep.com/phptu/6.html.
Edit: You should also make sure you keep your form in sync with your SQL INSERT statement. You have username, email, password, gender and age in your form but only username, email and password in your INSERT statement so gender and age will not be added to your database and the data will not be remembered.
Post a Comment for "How To Output Registration Form Data To The Current Page And Another Page?"