|
|
|
รบกวนขอโค้ดแจ้งเตือนให้กรอกข้อมูลให้ครบทุกช่องหน่อยคะ |
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>ข้อมูลบริษัทตัวแทนจำหน่าย</title>
<link rel="stylesheet" type="text/css" href="../scsticker/css/formstyle.css"/>
<link rel="stylesheet" href="../scsticker/css/buttons.css">
<script type="text/javascript" src="../buttons/js/buttons.js"></script>
<script src="../scsticker/js/jquery-1.10.1.min.js"></script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href="../scsticker/css/customize-template.css" type="text/css" media="screen, projection" rel="stylesheet"/>
<link rel="stylesheet" href="assets/css/styles.css"/>
<link rel="stylesheet" href="../scsticker/css/fonts_googleapis.css"/>
</head>
<body>
<h4>
<?php
include("connect.php");
$db = "scsticker";
$result = mysql_select_db($db);
if(!$result){
die('Could not find database called supplier: '. mysql_error());
}
$id_supplier = $_POST["id_supplier"];
$name_supplier = $_POST["name_supplier"];
$address_supplier = $_POST["address_supplier"];
$name_agen = $_POST["name_agen"];
$tel_supplier = $_POST["tel_supplier"];
$fax_supplier= $_POST["fax_supplier"];
$email_supplier= $_POST["email_supplier"];
$test_id = "select id_supplier from supplier where id_supplier ='".$id_supplier."'";
$tmp = mysql_query($test_id);
$rows = mysql_num_rows($tmp);
if($rows > 0){
echo "<br/>";
echo "<br/>";
echo "<section class='page container'>";
echo "<div class='row'>";
echo "<div class='span16'>";
echo "<div class='box'>";
echo "<a href='index.html' class='button button-rounded button-flat'>หน้าหลัก</a>";
echo "<a href='masterdata.html' class='button button-rounded button-flat'>ข้อมูลพื้นฐาน</a>";
echo "<a href='supplier.php' class='button button-rounded button-flat'>ข้อมูลบริษัทตัวแทนจำหน่าย</a>";
echo "<a href='supplier_form_insert.php' class='button button-rounded button-flat'>เพิ่มข้อมูลบริษัทตัวแทนจำหน่าย</a><br/><br/>";
echo "<div class='box-header'>";
echo "<i class='icon-bookmark' align='left'></i>";
echo "<h5>เพิ่มข้อมูลบริษัทตัวแทนจำหน่าย</h5>";
echo "</div><br/>";
echo "<div class='box-content'>";
echo "<center> <div class='btn-group-box'> ";
echo "<div class='col-lg-6'>";
echo "<h2></h2>";
echo "<div class='table-responsive'>";
echo "<center>";
echo "ไม่สามารถเพิ่มข้อมูลได้มีรหัสบริษัทตัวแทนจำหน่ายนี้อยู่ในระบบแล้ว<br><br>";
echo "<input class='button button-rounded button-flat-highlight' type='submit' value='ย้อนกลับ' ONCLICK=window.location.href='supplier_form_insert.php'>";
exit;
}else{
$sql = "insert into `scsticker`.`supplier` (`id_supplier`, `name_supplier`, `address_supplier`, `name_agen`, `tel_supplier`, `fax_supplier`, `email_supplier`)
values ('".$id_supplier."', '".$name_supplier."', '".$address_supplier."', '".$name_agen."', '".$tel_supplier."', '".$fax_supplier."', '".$email_supplier."')";
$result = mysql_query($sql);
if(!$result){
die('Insert not success !!!: '. mysql_error());
}
}
?>
</h4></center>
<script>
location="supplier.php";
</script>
</body>
</html>
ตอนนี้ถ้าเพิ่มแบบไม่กรอกอะไรมันจะเป็นแบบนี้อ่ะคะ
Tag : PHP
|
|
|
|
|
|
Date :
2015-11-13 14:26:05 |
By :
POMP |
View :
2327 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แบบง่ายๆ นะครับ
Code (PHP)
$id_supplier = $_POST["id_supplier"];
$name_supplier = $_POST["name_supplier"];
$address_supplier = $_POST["address_supplier"];
$name_agen = $_POST["name_agen"];
$tel_supplier = $_POST["tel_supplier"];
$fax_supplier= $_POST["fax_supplier"];
$email_supplier= $_POST["email_supplier"];
เช็คค่าพวกนี้ ถ้าว่างให้ alert
กับอีกแบบ ใช้ javascript พวก jquery ลองเสิช google ดูเลยจ้า
|
|
|
|
|
Date :
2015-11-13 14:43:55 |
By :
progamer2000 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|