Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require '../assets/connect.php';
- if(isset($_POST['update'])){
- error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
- /////////////Collect form data/////////////
- $name = !empty($_REQUEST['name']) ? trim($_REQUEST['name']) : null;
- $email = !empty($_REQUEST['email']) ? trim($_REQUEST['email']) : null;
- $value = !empty($_REQUEST['value']) ? trim($_REQUEST['value']) : null;
- $contact = !empty($_REQUEST['contact']) ? trim($_REQUEST['contact']) : null;
- $phone = !empty($_REQUEST['phone']) ? trim($_REQUEST['phone']) : null;
- $status = !empty($_REQUEST['status']) ? trim($_REQUEST['status']) : null;
- $nextAction = !empty($_REQUEST['nextAction']) ? trim($_REQUEST['nextAction']) : null;
- $storeName = !empty($_REQUEST['store']) ? trim($_REQUEST['store']) : null;
- $region = !empty($_REQUEST['region']) ? trim($_REQUEST['region ']) : null;
- $data = [
- 'name' => $name,
- 'email' => $email,
- 'value' => $value,
- 'contact' => $contact,
- 'phone' => $phone,
- 'status' => $status,
- 'nextAction' => $nextAction,
- 'storeName' => $storeName,
- 'region' => $region,
- ];
- $sql = "INSERT INTO company(companyName, coEmail, Deal_Value, Contact_name, Phone, Status, Next_Action_Item, Store_Name, Region)
- VALUES (:name,
- :email,
- :value,
- :contact,
- :phone,
- :status,
- :nextAction,
- :storeName,
- :region
- )";
- $stmt= $pdo->prepare($sql);
- if($stmt->execute($data)){
- $_SESSION['success'] = "Successfully Submitted Request";
- header('Location: index.php');
- exit();
- }else{
- $_SESSION['success'] = "Did not send, Try again";
- print_r($sql->errorInfo()); // if any error is there it will be posted
- $msg=" Database problem, please contact site admin ";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment