PDA

View Full Version : PhpInsertInto



Mocha
03-04-2011, 03:10 AM
Just something quick I made to share with you guys.


<html>
<form name="form1" method="post" action="">
<p>
<label for="textfield">360Haven Username:</label>
<input type="text" name="username" id="textfield">
</p>
<p>
<label for="textfield2">Gamer-Tag:</label>
<input type="text" name="gamertag" id="textfield2">
</p>
<p>
<label for="textfield3">First Name:</label>
<input type="text" name="name" id="textfield3">
</p>
<p>
<label for="textfield4">Aim:</label>
<input type="text" name="aim" id="textfield4">
</p>
<p>
<label for="textfield5">Msn:</label>
<input type="text" name="msn" id="textfield5">
</p>
<p>
<input type="submit" name="submit" id="button" value="Submit Contact">
</p>

</form>

<?php
/* MySQL Login Structure*/
$Host = "";
$DB_Name = "";
$DB_Username = "";
$DB_Password = "";

/*MySQL Table Info/Structure*/
$DB_Table_Name = "";
$Column_0 = "";
$Column_1 = "";
$Column_2 = "";
$Column_3 = "";
$Column_4 = "";
$Column_5 = "";

/* Connects to the MySQL Database*/
$Connection = mysql_connect($Host, $DB_Username, $DB_Password) or die("Contact Manager could not establish a connection to the MySQL Database");
mysql_select_db($DB_Name,$Connection) or die ("Contact Manager could not select the MySQL Database");

/*Performs MySQL Query*/
$Query = mysql_query("INSERT INTO $DB_Table_Name") or die("Contact Manager could not perform the MySQL query");
if(issey($_POST['submit']))
{
$Query;
}
mysql_close($Connection);
?>
</html>