Location: PHPKode > projects > Simple PHP Shopping cart - asaancart > asaancart v-0.9/admin/add_customer.php
<?php
session_start();
/*
asaancart - easy shopping cart solution
---------------------------------------

Copyright 2009 Nasir Ahmad Khan
Email: hide@address.com

This file is part of asaancart - open source easy shopping cart solution.

asaancart is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

asaancart is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with asaancart.  If not, see <http://www.gnu.org/licenses/>.

*/

include("../config/config.php");
include("includes/chk_login_status_inc.php");

$smarty->assign('title','Add Customer');

$customer_name = $_POST['customer_name'];
$business_name = $_POST['business_name'];
$customer_address = $_POST['customer_address'];
$customer_country = $_POST['customer_country'];
$customer_state = $_POST['customer_state'];
$customer_city = $_POST['customer_city'];
$customer_suburb = $_POST['customer_suburb'];
$customer_postcode = $_POST['customer_postcode'];
$customer_mobile = $_POST['customer_mobile'];	
$customer_phone = $_POST['customer_phone'];
$email_address = $_POST['email_address'];
$mailing_list = $_POST['mailing_list'];
if($mailing_list==""){$mailing_list="no";}
//billing
$b_customer_address = $_POST['b_customer_address'];
$b_customer_country = $_POST['b_customer_country'];
$b_customer_state = $_POST['b_customer_state'];
$b_customer_city = $_POST['b_customer_city'];
$b_customer_suburb = $_POST['b_customer_suburb'];
$b_customer_postcode = $_POST['b_customer_postcode'];
//shipping
$s_customer_address = $_POST['s_customer_address'];
$s_customer_country = $_POST['s_customer_country'];
$s_customer_state = $_POST['s_customer_state'];
$s_customer_city = $_POST['s_customer_city'];
$s_customer_suburb = $_POST['s_customer_suburb'];
$s_customer_postcode = $_POST['s_customer_postcode'];



if($_POST['btn_create']=="Save")
{	
	
		//srand((double)microtime()*1000000);
		//$product_id = md5(uniqid(rand()));
		if($email_address!=""){
		//inser into product table 
			$sql = "INSERT INTO customers (customer_name, business_name, customer_country, customer_state, customer_city, customer_suburb, customer_postcode, customer_mobile, customer_phone, email_address, customer_address, b_customer_country, b_customer_state, b_customer_city, b_customer_suburb, b_customer_postcode, b_customer_address, s_customer_country, s_customer_state, s_customer_city, s_customer_suburb, s_customer_postcode, s_customer_address, mailing_list) VALUES ('$customer_name', '$business_name', '$customer_country', '$customer_state', '$customer_city', '$customer_suburb', '$customer_postcode', '$customer_mobile', '$customer_phone', '$email_address', '$customer_address', '$b_customer_country', '$b_customer_state', '$b_customer_city', '$b_customer_suburb', '$b_customer_postcode', '$b_customer_address', '$s_customer_country', '$s_customer_state', '$s_customer_city', '$s_customer_suburb', '$s_customer_postcode', '$s_customer_address', '$mailing_list')";
			$results = mysql_query($sql);
		
		
			$smarty->assign('msg_customer','Added Successfully');
		}else{
			$smarty->assign('msg_customer',"<span style'color:red;'>Error, you must enter email address. Please enter email address</span>");
		}

}

$smarty->display('add_customer.tpl');
?>
Return current item: Simple PHP Shopping cart - asaancart