Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/142909-need-a-form-to-be-dynamically-populated/
Share on other sites

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.