|
|
|
สอบถามโค้ต เมื่อกรอกข้อมูลและกด submit ให้แสดงข้อมูลนั้น php |
|
|
|
|
|
|
|
อันนี้ code ที่สร้างจาก Dream ครับ
บันทึกข้อมูลเข้า Database ได้
เลยอยากได้โค้ตที่แสดงข้อมูลที่เพิ่งบันทึกไปครับ รบกวนด้วยครับ โดนบังคับให้ทำเลยไม่มีเวลาศึกษาเท่าไหร่ครับ ขอบคุณล่วงหน้าครับ
Code (PHP)
<?php require_once('../Connections/myconnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO save_data1 (name_dam, city_dam, area_dam, `day`, `month`, years, detail1, detail2, detail3) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['name_dam'], "text"),
GetSQLValueString($_POST['city_dam'], "text"),
GetSQLValueString($_POST['area_dam'], "text"),
GetSQLValueString($_POST['day'], "int"),
GetSQLValueString($_POST['month'], "int"),
GetSQLValueString($_POST['years'], "int"),
GetSQLValueString($_POST['detail1'], "text"),
GetSQLValueString($_POST['detail2'], "text"),
GetSQLValueString($_POST['detail3'], "text"));
mysql_select_db($database_myconnect, $myconnect);
$Result1 = mysql_query($insertSQL, $myconnect) or die(mysql_error());
$insertGoTo = "showdata.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>"name_dam">
<div align="justify">ชื่อเขื่อน:</div>
</label>
<div align="justify">
<input type="text" name="name_dam" id="name_dam"style="width:500px;">
<br>
</div>
<label for="city_dam">
<div align="justify">จังหวัด:</div>
</label>
<div align="justify">
<input type="text" name="city_dam" id="city_dam"style="width:500px;">
<br>
</div>
<label for="area_dam">
<div align="justify">บริเวณที่พบ:</div>
</label>
<div align="justify">
<input type="text" name="area_dam" id="area_dam"style="width:500px;">
<br>วัน/เดือน/ปี:
</div>
<label for="day"></label>
<select name="day" size="1" id="day">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<label for="month"></label>
<select name="month" size="1" id="month">
<option value="1">มกราคม</option>
<option value="2">กุมภาพันธ์</option>
<option value="3">มีนาคม</option>
<option value="4">เมษายน</option>
<option value="5">พฤษภาคม</option>
<option value="6">มิถุนายน</option>
<option value="7">กรกฎาคม</option>
<option value="8">สิงหาคม</option>
<option value="9">กันยายน</option>
<option value="10">ตุลาคม</option>
<option value="11">พฤศจิกายน</option>
<option value="12">ธันวาคม</option>
</select>
<label for="years"></label>
<select name="years" size="1" id="years">
<option value="2490">2490</option>
<option value="2491">2491</option>
<option value="2492">2492</option>
<option value="2493">2493</option>
<option value="2494">2494</option>
<option value="2495">2495</option>
<option value="2496">2496</option>
<option value="2497">2497</option>
<option value="2498">2498</option>
<option value="2499">2499</option>
<option value="2500">2500</option>
<option value="2501">2501</option>
<option value="2502">2502</option>
<option value="2503">2503</option>
<option value="2504">2504</option>
<option value="2505">2505</option>
<option value="2506">2506</option>
<option value="2507">2507</option>
<option value="2508">2508</option>
<option value="2509">2509</option>
<option value="2510">2510</option>
<option value="2511">2511</option>
<option value="2512">2512</option>
<option value="2513">2513</option>
<option value="2514">2514</option>
<option value="2515">2515</option>
<option value="2516">2516</option>
<option value="2517">2517</option>
<option value="2518">2518</option>
<option value="2519">2519</option>
<option value="2520">2520</option>
<option value="2521">2521</option>
<option value="2522">2522</option>
<option value="2523">2523</option>
<option value="2524">2524</option>
<option value="2525">2525</option>
<option value="2526">2526</option>
<option value="2527">2527</option>
<option value="2528">2528</option>
<option value="2529">2529</option>
<option value="2530">2530</option>
<option value="2531">2531</option>
<option value="2532">2532</option>
<option value="2533">2533</option>
<option value="2534">2534</option>
<option value="2535">2535</option>
<option value="2536">2536</option>
<option value="2537">2537</option>
<option value="2538">2538</option>
<option value="2539">2539</option>
<option value="2540">2540</option>
<option value="2541">2541</option>
<option value="2542">2542</option>
<option value="2543">2543</option>
<option value="2544">2544</option>
<option value="2545">2545</option>
<option value="2546">2546</option>
<option value="2547">2547</option>
<option value="2548">2548</option>
<option value="2549">2549</option>
<option value="2550">2550</option>
<option value="2551">2551</option>
<option value="2552">2552</option>
<option value="2553">2553</option>
<option value="2554">2554</option>
<option value="2555">2555</option>
<option value="2556">2556</option>
<option value="2557">2557</option>
<option value="2558">2558</option>
<option value="2559">2559</option>
<option value="2560">2560</option>
<option value="2561">2561</option>
<option value="2562">2562</option>
<option value="2563">2563</option>
</select>
<br>
<label for="detail1">
<div align="justify">เหตุการณ์/ลักษณะการบกพร่องที่เกิดขึ้น:</div>
</label>
<div align="justify">
<textarea name="detail1" id="detail1" style="width:500px; height:200px;"></textarea>
<br>
</div>
<label for="detail2">
<div align="justify">รายละเอียดการปรับปรุง/แก้ไข:</div>
</label>
<div align="justify">
<textarea name="detail2" id="detail2" style="width:500px; height:200px;"></textarea>
<br>
</div>
<label for="detail3">
<div align="justify">หมายเหตุ:</div>
</label>
<div align="justify">
<textarea name="detail3" id="detail3" style="width:500px; height:50px;"></textarea>
</div><br>
<input name="btnsavedata" type="submit" id="btnsavedata" value="บันทึก">
<input type="reset" name="btnclear" id="btnclear" value="ล้างข้อมูล">
<input type="button" name="btncancel" id="btncancel" value="ยกเลิก">
<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>
Tag : PHP, MySQL, HTML, CSS, jQuery, Windows
|
|
|
|
|
|
Date :
2019-06-15 23:54:47 |
By :
busstopsw |
View :
617 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<body>
<?php
if( isset($_POST['xxxxx'])){?>
<div><?=$_POST['xxxx']?></div>
<?php } ?>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>"name_dam">
|
|
|
|
|
Date :
2019-06-16 06:12:13 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|