<?
if (count(get_included_files()) ==1) die("<h4>You don't have right permission to access this file directly.</h4>");

  require "conn2.php";

  try {
      $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
      // set the PDO error mode to exception
      $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

      // prepare sql and bind parameters
      $stmt = $conn->prepare("INSERT INTO merchant (nama, roc, telefon, email, tarikh, username, password, carwash, polish, repair, accessories, insurance)
      VALUES (:nama, :roc, :telefon, :email, :tarikh, :username, :password, :carwash, :polish, :repair, :accessories, :insurance)");

      $stmt->bindParam(':nama',         $nama);
      $stmt->bindParam(':roc',          $roc);
      $stmt->bindParam(':telefon',      $telefon);
      $stmt->bindParam(':email',        $email);
      $stmt->bindParam(':tarikh',       $tarikh);
      $stmt->bindParam(':carwash',      $carwash);
      $stmt->bindParam(':polish',       $polish);
      $stmt->bindParam(':repair',       $repair);
      $stmt->bindParam(':accessories',  $accessories);
      $stmt->bindParam(':insurance',    $insurance);
	  $stmt->bindParam(':username',     $usrnm);
      $stmt->bindParam(':password',     $pswd);


      $stmt->execute();
      
     
      // prepare db 1000
/*
      $stmt->bindParam(':rujukan', 'Startup DB');
      $stmt->bindParam(':masuk', 1000);
      $stmt->bindParam(':userid', $lastid);
      $stmt = $conn->prepare("INSERT INTO db (tarikh, keterangan, rujukan, masuk, userid)
      VALUES (:tarikh, :keterangan, :rujukan, :masuk, :userid)");
 */
      echo "<div class=\"alert alert-success\"><strong>Congratulations!</strong> You have successfully signed up new members.</div>";
      // echo "Welcome email has been sent to ".$email;
      //echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n";
      }
  catch(PDOException $e)
      {
      echo "Error: " . $e->getMessage();
      }
  $conn = null;
?>
