Home
Main Page

PHP Basic
Introduction
Syntax
Variables
Operators
If...Else
Switch
Arrays
Looping
Functions
Forms
GET
POST

PHP Advanced
Date
Include
File
File Upload
Cookies
Sessions
Mail
Secure Mail

MySQL Database
Introduction
Connect
Create
Insert
Select
Where
Order By
Update
Delete

PHP Database
ODBC

PHP Reference
PHP Manual

PHP $_POST



ตัวแปร $_POST

ตัวแปร $_POST เป็นตัวแปรที่รับและส่งโดย HTTP POST จะต่างจากแบบ HTTP GET ซึ่งผู้ใช้จะไม่สามารถเห็นค่าที่ส่งไปได้ และส่งค่าได้ไม่จำกัด

มาดูตัวอย่างการเขียนแบบฟอร์มด้วยวิธี $_POST กัน
<html>
<body>
<form action="register.php" method="POST">
กรอกชื่อ: <input type="text" name="name" />
กรอกอายุ: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>
ไฟล์ register.php ซึ่งเป็นหน้ารับค่าและแสดงผล จะต้องใช้ตัวแปร $_POST เพื่อแสดงค่าที่รับมาดังนี้

ยินดีต้อนรับ คุณ <?php echo $_POST["name"]; ?><br />
คุณอายุ <?php echo $_POST["age"]; ?> ปี!
การส่งด้วยวิธี $_POST นั้นสามารถส่งข้อมูลได้ไม่จำกัด จะเหมาะเมื่อใช้โพสข้อความที่ยาวๆ และผู้ใช้ไม่สามารถเห็นข้อมูลที่ส่ง จะเหมาะอย่างยิ่งที่จะส่งข้อมูลอันเป็นความลับ



Related Sites
php.net
mysql
phpMyAdmin
apache
thainuke
microsoft
linux
PostgreSQL
Zend Technologies
CentOS

Special Thanks
ohohost.com
w3schools.com

Advertise




Power By



 
2279212







Copyright 2006 by Phpstreet. All Rights Reserved.