$stmt->execute(array(":sup_code" => $scode)); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($stmt->rowCount() > 0) { $msg = '<div class="alert alert-warning alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <h4> <i class="icon fa fa-check"></i> Sorry!</h4> supplier allready exists , Please Try another one. </div>'; // $msg = " // <div class='alert alert-error'> // <button class='close' data-dismiss='alert'>×</button> // <strong>Sorry !</strong> email allready exists , Please Try another one // </div> // "; } else { if ($supplier->register($scode, $fname, $lname, $nic, $iCheck, $email, $address_1, $mobile, $estate, $estate_name, $reg_no, $size_of_estate, $estate_address, $bankn, $branch, $account, $bankacc, $editor)) { $message = "Thalapalakanada Tea factory, username: 0001 password: {$nic} http://tsms.x10host.com/page/"; if (!empty($mobile)) { $mobileNumber = Communication::prepareNumber($mobile); Communication::sendMessage($message, $mobileNumber); } echo ' <div class="row"> <div class="col-md-12"> <div class="box"> <div class="box-header"> <h3 class="box-title">Supplier Settings</h3> </div> <div class="box-body"> <p>Supplier Successfuly added to the database. Also You can change Supplier settings.</p> <a class="btn btn-app">
<?php require_once 'core/init.php'; if (count($_POST) > 0) { $supplier_data = array("company" => $_POST["company"], "email" => $_POST["email"], "street" => $_POST["street"], "line2" => $_POST["line2"], "city" => $_POST["city"], "province" => $_POST["province"], "postal" => $_POST["postal"], "country" => $_POST["country"], "telephone" => $_POST["links"]); $_SESSION['form_data'] = $supplier_data; header("Location: supplier_registration.php", true, 303); die; } else { if (isset($_SESSION['form_data'])) { $new_supplier = new Supplier(); print_r($_SESSION["form_data"]); $new_supplier->create($_SESSION["form_data"]); if ($new_supplier->register()) { $message = "You have successfully Registered the Supplier !!"; echo "<script type='text/javascript'>alert('{$message}');</script>"; } else { $message = "The Supplier Registration was unsuccessful."; echo "<script type='text/javascript'>alert('{$message}');</script>"; } unset($_SESSION["form_data"]); } } ?> <!DOCTYPE html> <html> <head> <title>Supplier Management</title>