# HTML form to MySql database via PHP

**URL:** <https://forum.kirupa.com/t/html-form-to-mysql-database-via-php/177954>\
**Category:** programming\
**Created:** [February 6, 2006, 6:32pm UTC](https://forum.kirupa.com/t/html-form-to-mysql-database-via-php/177954 "2006-02-06T18:32:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chunk](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@chunk](https://forum.kirupa.com/u/chunk)\
**Post date:** [February 6, 2006, 6:32pm UTC](https://forum.kirupa.com/t/html-form-to-mysql-database-via-php/177954/1 "2006-02-06T18:32:54Z")

</div>

Hi, Im new to PHP and MySql and was wondering how exactly I would pass information colected from a form to a MySql database using PHP…

This is what I have come up with (Don’t laugh :P)

Witin the form, clicking the submit button will take you to a php script using the POST method.

method=“post” action=“html2mysql.php”

> [@html2mysql.php](#):
>
> \<?php  
> $settings[‘siteDir’] = ‘[mywebsite.com is available for purchase - Sedo.com](http://www.mywebsite.com/MySqlInputForm/)’;  
> $settings[‘dbhost’] = ‘localhost’;  
> $settings[‘dbname’] = ‘dbname’;  
> $settings[‘dbusername’] = ‘dbuser’;  
> $settings[‘dbpassword’] = ‘dbpass’;
> 
> $this-\>link = mysql\_connect($host, $user, $pass);  
> mysql\_select\_db($dbname);
> 
> $MySqlDatabaseItem1 = $\_POST[‘FormItemFromHtmlDocument1’];  
> $MySqlDatabaseItem2 = $\_POST[‘FormItemFromHtmlDocument2’];  
> $MySqlDatabaseItem3 = $\_POST[‘FormItemFromHtmlDocument3’];
> 
> ?\>

Somthing along this lines, Can anyone nudge me into the right direction of what I would need to put into my html2sql ?

I need somthing that tells it to put,

$MySqlDatabaseItem1 into MyDatabase1 -\> Table1 -\> Column1  
$MySqlDatabaseItem2 into MyDatabase1 -\> Table1 -\> Column2  
$MySqlDatabaseItem3 into MyDatabase1 -\> Table1 -\> Column3
