trouble706 Posted January 29, 2009 Share Posted January 29, 2009 Hello, I have a site that requires membership in order to receive information on plays that are available for usage. When a member views a play and wants more information, he/she is redirected to a form that should be submitted. I would like for the basic membership information name, etc. to be dynamically populated so that the member only has to select the particular play that they want information on. I am not sure how to do this. Can someone point me in the right direction? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/142909-need-a-form-to-be-dynamically-populated/ Share on other sites More sharing options...
satishgadhave Posted January 29, 2009 Share Posted January 29, 2009 hi trouble706 As the user is already a member you can fetch its information from database and populate in the form page. User can edit populated data and submit the form. Quote Link to comment https://forums.phpfreaks.com/topic/142909-need-a-form-to-be-dynamically-populated/#findComment-749371 Share on other sites More sharing options...
trouble706 Posted January 29, 2009 Author Share Posted January 29, 2009 I am not quite sure how to do this...I am not asking anyone how to do it for me..I want to be able to do it myself but if someone can guide me a little in getting started with it, it will be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/142909-need-a-form-to-be-dynamically-populated/#findComment-749944 Share on other sites More sharing options...
satishgadhave Posted January 30, 2009 Share Posted January 30, 2009 suppose a new user registered to become a member. You got user's details (name, address etc.) from registration form and saved in database. Now, when this user logs in, views a play and wants more information, you redirect him to a form. In this form file you can fetch user details you already entered in the database. Echo this information in HTML part of the form. e.g. (i'm assuming you have user's id when he logs in) <?php $query = "SELECT * FROM users WHERE userId = ".$userId; $resultSet = mysql_query($query, $link); //-- $link is database connection link $userData = mysql_fetch_array($resultSet); ?> <html> <head></head> <body> <form action="" method="post"> Name: <input type="text" name="userName" value="<?php echo $userData['userName']; ?>" /> Address: <input type="text" name="address" value="<?php echo $userData['address']; ?>" /> Question: <input type="text" name="question" value="" /> <input type="submit" name="submit" value=" Submit " /> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/142909-need-a-form-to-be-dynamically-populated/#findComment-750454 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.