Jump to content

pre-fill form help


nightrain

Recommended Posts

I have a basic form that sends user preferences to a database.  I'd like to make it so that when the user revisits the page, the form is pre-filled with their preferences.

 

lets say the form looks like this:

<form action="index.php" method="post">
<select name="color">
                <option value="" selected>select one</option>
                <option value="red">Red</option>
                <option value="blue">Blue</option>
        </select>

        <input name="submit" type="image" value="submit">
</form>

 

other necessary info:

 

hostname = localhost

username = username

password = password

database name = database

table name = table

primary key = user

colors row = color

 

given the above, can anyone help me with a sample script that will prefill the color field using the database?

 

thanks for your help!

Link to comment
https://forums.phpfreaks.com/topic/104977-pre-fill-form-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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