php - insert form data into table -


my form emails data customer ok, need save data table called card, doesn't do. please let me know i'm going wrong. i'm it's when connect db.

<?php  if(isset($_post['email'])) { $email_to = ($_post['email']); $email_subject = "customer registration";      function died($error) {  // sese     echo "we sorry, there error(s) found form     submitted. ";     echo "these errors appear below.<br /><br />";     echo $error."<br /><br />";     echo "please go , fix these errors.<br /><br />";     die();   }  // siati data  if(!isset($_post['first_name']) ||     !isset($_post['last_name']) ||      !isset($_post['pay_address1']) ||     !isset($_post['pay_address2']) ||     !isset($_post['pay_address3']) ||     !isset($_post['pay_address4']) ||     !isset($_post['pay_contact_no']) ||     !isset($_post['email']) ||      !isset($_post['password']) ||      !isset($_post['security'])) {      died('we sorry, there appears problem form submitted.');         }  $first_name = $_post['first_name']; // manaomia  $last_name = $_post['last_name']; // manaomia $address1 = $_post['pay_address1']; // manaomia $address2 = $_post['pay_address2']; // manaomia $address3 = $_post['pay_address3']; // manaomia $address4 = $_post['pay_address4']; // manaomia $reference = $_post['email']; // manaomia  $customer_pass = $_post['password']; // manaomia  $contact_no = $_post['pay_contact_no']; // pule oe  $security = $_post['security']; // manaomia    $dbconn = pg_connect("host=127.0.0.1 dbname=ina user=suser     password=abcdefg") or die('could not connect: ' . pg_last_error()); $query = "insert card (reference, first_name, last_name, address1,  address2, address3, address4, contact_no, customer_pass) values ($reference, $first_name, $last_name, $address1, $address2, $address3, $address4, $contact_no, $customer_pass)";  $result = pg_query($query);     if (!$result)   {   echo "customer update failed!!";   } else   {   echo "update successfull; ";   }        pg_close();        $error_message = "";  $email_exp = '/^[a-za-z0-9._%-]+@[a-za-z0-9.-]+\.[a-za-z]{2,4}$/';  if(!preg_match($email_exp,$reference)) {  $error_message .= 'the email address entered not appear   valid.<br />';  }  $string_exp = "/^[a-za-z .'-]+$/";  if(!preg_match($string_exp,$first_name)) {  $error_message .= 'the first name entered not appear   valid.<br />';  }  if(!preg_match($string_exp,$last_name)) {  $error_message .= 'the last name entered not appear valid.    <br />';  }  if(strlen($security) != 5) {  $error_message .= 'the translation entered not appear  valid. <br />';   }  if(strlen($error_message) > 0) {   died($error_message);  }   $email_message = "your login details below.\n\n";   function clean_string($string) {   $bad = array("content-type","bcc:","to:","cc:","href");   return str_replace($bad,"",$string);  }  $email_message .= "login id: ".clean_string($reference)."\n";  $email_message .= "password: ".clean_string($password)."\n";   // email headers  $headers = 'from: ' . $from . "\r\n";  'reply-to: '.$from."\r\n" .  'x-mailer: php/' . phpversion();  @mail($email_to, $email_subject, $email_message, $headers);    ?>    thank registering. email containing login id ,     password sent provided email address. please check mail , log in continue.  next button  <?php  }  ?> 

$dbconn = pg_connect("host=127.0.0.1 dbname=ina user=suser     password=abcdefg") or die('could not connect: ' . pg_last_error());     $query = "insert card ('reference'=>$reference, 'first_name'=>$first_name, 'last_name'=>$last_name, 'address1'=>$address1,  'address2'=>$address2, 'address3'=>$address3, 'address4'=>$address4, 'contact_no'=>$contact_no, 'customer_pass'=>$customer_pass,'security'=>$security)";      //or use condition     //insert customers (customername, contactname, address, city, postalcode, country)     //values ('cardinal','tom b. erichsen','skagen 21','stavanger','4006','norway'); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -