|
![](/images/resource/spacer.gif) |
|
เมื่อกดปุ่ม submit แล้ว พอaction ไปอีกหน้าหนึ่งจะแสดงแต่โค้ด |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>เก็บข้อมูล</title>
</head>
<body>
<form method="post" action="save.php">
ชื่อ : <input type="text" name="txt_name" /><br />
สกุล : <input type="text" name="txt_skul" /><br />
อายุ : <input type="text" name="txt_age" /><br />
<input type="submit" value="ส่งข้อมูล" />
</body>
</html>
Code (PHP)
<?php
mysql_connect("localhost","root","12345678");
mysql_select_db("informe");
if(trim($_POST["txt_name"]) == "")
{
echo "กรุณาใส่ชื่อด้วย";
exit();
}
if(trim($_POST["txt_skul"]) == "")
{
echo "ใส่นามสกุลด้วย";
exit();
}
if($_POST["txt_age"] == "")
{
echo "ใส่อายุด้วย";
exit();
}
$strSQL = "INSERT INTO info (Name,Skul,Age) VALUES ('".$_POST["txt_name"]."',
'".$_POST["txt_skul"]."','".$_POST["txt_age"]."')";
$objQuery = mysql_query($strSQL);
echo "เก็บข้อมูลแล้วครัช";
mysql_close();
?>
Tag : PHP, MySQL, Ms SQL Server 2008, Ms SQL Server 2012, HTML/CSS, CakePHP
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-03-20 15:58:45 |
By :
jeerawan |
View :
1454 |
Reply :
1 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
คุณได้รันผ่าน Web Server หรือเปล่าครับ ![](/images/bbcode/grin.gif?v=1001)
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-03-20 17:04:15 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 02
|