HTML form, Javascript, PHP an MySQL integration? Inserting form data into MySQL table

How would one take input from HTML forms, and then use PHP to insert that data into a MySQL table?

For instance say the forms are like this - fields for first name and last name (text), gender (radio), and state (drop-down):

<input id="input_firstname" maxlength="20" name="firstname" size="10" type="text" />
<input id="input_lastname" maxlength="20" name="lastname" size="10" type="text" />

<input checked="checked" id="input_gender_m" name="gender_m" type="radio" value="M" />Male
<input id="input_gender_f" name="gender_f" type="radio" value="F" />Female

<select id="input_stateid" name="stateid"><option value="">Choose state</option>
<option value="1">Alabama</option>
...
<option value="50">Wyoming</option></select>

Assume that the values for the database login ($username, $password, $host, $dbname) are contained in a config.php file. And that each MySQL table field is a varchar field.

How does one integrate the data captured in the forms, and then insert that into the MySQL table?

One writes the PHP code that receives the form values, validates and sanitizes them, and then inserts them in the database. :slight_smile:

If you don’t know any PHP, then you might want to start by googling “php mysql form” or something like that, and follow one of the tons of examples and tutorials that you’ll find.