How to make a database fill out parts of a form?
I am looking for information on how I can use a database to fill in parts of a form.
I have a Notify Me form that will be available on two different pages. On the first page, the customer will have to fill out the entire form. (Ensuring I know what开发者_运维知识库 item they want to notified about.)
On another page is a database in which I will have all the items listed plus item that are not yet available. (The database entry will be seen before the item is available and the notify me form will be a marketing tool the item.)I want to include a link to the same Notify Me form, as seen on the first page, in the database, however, I would like this form to check the database to see if the item is already entered, and if so, fill out that information in the form.
Notify Me form
Field 1: Customer Name
Field 2: Email
Field 3: Model Number of item
MySQL Database
Field 1: Type
Field 2: Model Number
Field 3: Price
Field 4: Link to form
So, as you can see the Model Number is in both the form and the database. If my customer clicks on the link for the form from within the database (Field 4), I want Field 3 of the Notify Me form to be automatically filled out with the value in Field 2 of the database with in the form opens.
Not quite sure what you're asking, but maybe this is what you need?
<?php
$modelNumber = mysql_fetch_array(mysql_query("SELECT ModelNumber FROM ? WHERE ?"));
?>
<input type="text" name="modelNum" value="<?php if ( $modelNumber != "") { echo $modelNumber; } ?>"/>
精彩评论