saving customer details to a database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jlabobedi
    New Member
    • Oct 2014
    • 1

    saving customer details to a database

    Currently we have a customer details form where customers update their details in the website,when they click submit it sends the details to an email below code :
    Code:
    <?php
    
    $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
    
    session_start();
    if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) { 
    mail("gotimile@wuc.bw","Customer Details Update Form Submission",
    
    "Form data:
    
    Plot No.: " . $_POST['field_1'] . 
    
    " 
    Customer (Business Partner) No.: " . $_POST['field_2'] . 
    
    " 
    Last Name: " . $_POST['field_3'] . 
    
    " 
    First Name: " . $_POST['field_4'] . 
    
    " 
    Date of Birth: " . $_POST['field_5'] . 
    
    " 
    Place of Birth: " . $_POST['field_6'] . 
    
    " 
    Marital Status: " . $_POST['field_7'] . 
    
    " 
    Identification: " . $_POST['field_8'] . 
    
    " 
    Input ID details (as selected above): " . $_POST['field_9'] . 
    
    " 
    Postal Address: " . $_POST['field_10'] . 
    
    " 
    
    
     Powered by www.wuc.bw.
    ");
    
    include("confirm.html");
    }
    else {
    echo "Invalid Captcha String.";
    }
    
    ?>
    ,so I have to edit it that when the customer click submit it should save customer details to a database not sending an email.I have already created the customer details in the database
    Last edited by Rabbit; Oct 6 '14, 03:48 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I have to edit it that when the customer click submit it should save customer details to a database
    what have you tried so far?

    Comment

    • Bala Kumaran
      New Member
      • Jan 2013
      • 30

      #3
      Hello jlabobedi,

      I think your question was wrong. Because, You mentioned that the form submission contents should send to a particular email address.
      then, Why did you mentioned save details to "database"?

      And there is no any code mentioned to save to database in your script.

      If you want to send the submitted details from the form to be sent to your particular email address, You don't need to Start_session for sending mails via forms.

      Code:
      <?php
       
      $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
       
      
      if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) { 
      
      $to = "gotimile@wuc.bw";
      $email_subject = "Customer Details Update Form Submission";
      $email_body = "Form data: \n
      
      Plot No.: " . $_POST['field_1'] . " 
      Customer (Business Partner) No.: " . $_POST['field_2'] . " 
      Last Name: " . $_POST['field_3'] . " 
      First Name: " . $_POST['field_4'] . " 
      Date of Birth: " . $_POST['field_5'] . " 
      Place of Birth: " . $_POST['field_6'] . " 
      Marital Status: " . $_POST['field_7'] . " 
      Identification: " . $_POST['field_8'] . " 
      Input ID details (as selected above): " . $_POST['field_9'] . " 
      Postal Address: " . $_POST['field_10'] . " 
       
      Powered by www.wuc.bw.";
      $headers = "From: $to";
      mail($to,$email_subject,$email_body,$headers);
       
      include("confirm.html");
      }
      else {
      echo "Invalid Captcha String.";
      }
       
      ?>
      Last edited by Bala Kumaran; Oct 7 '14, 01:16 PM. Reason: I forgot to adding Code tag

      Comment

      Working...