Sunday, December 19, 2010

Insert data php

enter_new.php
"; ?>
include_once("include/db_connection.php");
?>

Enter Customers


form name="customersEnterForm" method="POST" action="insert_new.php"
input type="text" name="thisCustomer_idField" size="20" value=""
======================================================================
insert_new.php

"; ?>
include_once("include/db_connection.php");
?>
// Retreiving Form Elements from Form
$thisCustomer_id = addslashes($_REQUEST['thisCustomer_idField']);
$thisFname = addslashes($_REQUEST['thisFnameField']);
$thisMname = addslashes($_REQUEST['thisMnameField']);
$thisLname = addslashes($_REQUEST['thisLnameField']);
$thisCompany = addslashes($_REQUEST['thisCompanyField']);
$thisTitle = addslashes($_REQUEST['thisTitleField']);
$thisAddress1 = addslashes($_REQUEST['thisAddress1Field']);
$thisAddress2 = addslashes($_REQUEST['thisAddress2Field']);
$thisAddress3 = addslashes($_REQUEST['thisAddress3Field']);
$thisCity = addslashes($_REQUEST['thisCityField']);
$thisState_province = addslashes($_REQUEST['thisState_provinceField']);
$thisCountry = addslashes($_REQUEST['thisCountryField']);
$thisPostal_code = addslashes($_REQUEST['thisPostal_codeField']);
$thisPhone = addslashes($_REQUEST['thisPhoneField']);
$thisFax = addslashes($_REQUEST['thisFaxField']);

$sqlQuery = "INSERT INTO customers (customer_id , fname , mname , lname , company , title , address1 , address2 , address3 , city , state_province , country , postal_code , phone , fax )
VALUES ('$thisCustomer_id' , '$thisFname' , '$thisMname' , '$thisLname' , '$thisCompany' , '$thisTitle' , '$thisAddress1' , '$thisAddress2' , '$thisAddress3' , '$thisCity' , '$thisState_province' , '$thisCountry' , '$thisPostal_code' , '$thisPhone' , '$thisFax' )";
$result = MYSQL_QUERY($sqlQuery);

No comments:

Post a Comment