Location: PHPKode > scripts > AFC MySQL Address Book > afc-mysql-address-book/output.php
<?php
# ----------------------------------------------------
# ----- AFC MySQL Address Book
# ----- Version 2.2
# ----- Created on: 05/10/07
# ----- Designed by: American Financing
# ----- http://www.americanfinancing.net
# ----- For more scripts, please visit us at http://www.americanfinancing.net/free-scripts.cfm
# ----- Please feel free to modify this script for your own purpose.
# ----- ENJOY!!!
# ----- You May Modify this script, but you may not resell it in anyway.
# ----------------------------------------------------

// Receiving variables
@$id = addslashes($_POST['id']);
@$First_Name = addslashes($_POST['First_Name']);
@$Last_Name = addslashes($_POST['Last_Name']);
@$Address = addslashes($_POST['Address']);
@$City = addslashes($_POST['City']);
@$State = addslashes($_POST['State']);
@$Zip = addslashes($_POST['Zip']);
@$Home_Phone = addslashes($_POST['Home_Phone']);
@$Cell_Phone = addslashes($_POST['Cell_Phone']);
@$Notes = addslashes($_POST['Notes']);
@$Business_Phone = addslashes($_POST['Business_Phone']);
@$Fax_Number = addslashes($_POST['Fax_Number']);
@$eMail_Address = addslashes($_POST['eMail_Address']);
@$Website_Address = addslashes($_POST['Website_Address']);

// Validation
//saving record to MySQL database


@$pfw_strQuery = "INSERT INTO `address-book`(`ID`,`First_Name`,`Last_Name`,`Address`,`City`,`State`,`Zip`,`Home_Phone`,`Cell_Phone`,`Notes`,`Business_Phone`,`Fax_Number`,`eMail_Address`,`Website_Address`)VALUES (\"$id\",\"$First_Name\",\"$Last_Name\",\"$Address\",\"$City\",\"$State\",\"$Zip\",\"$Home_Phone\",\"$Cell_Phone\",\"$Notes\",\"$Business_Phone\",\"$Fax_Number\",\"$eMail_Address\",\"$Website_Address\")" ;

//-------------------------EDIT
@$pfw_host = "localhost";
@$pfw_user = "username";
@$pfw_pw = "password";
@$pfw_db = "database-name";
//-------------------------EDIT ABOVE

$pfw_link = mysql_connect($pfw_host, $pfw_user, $pfw_pw);
if (!$pfw_link) {
 die('Could not connect: ' . mysql_error());
}
$pfw_db_selected = mysql_select_db($pfw_db, $pfw_link);
if (!$pfw_db_selected) {
die ('Can not use $pfw_db : ' . mysql_error());
}

//insert new record
$pfw_result = mysql_query($pfw_strQuery);
if (!$pfw_result) {
 die('Invalid query: ' . mysql_error());
}
mysql_close($pfw_link);

header("Location: saved.html");

?>
Return current item: AFC MySQL Address Book