งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

เสรี ชิโนดม seree@buu.ac.th PHP กับ Form เสรี ชิโนดม seree@buu.ac.th.

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "เสรี ชิโนดม seree@buu.ac.th PHP กับ Form เสรี ชิโนดม seree@buu.ac.th."— ใบสำเนางานนำเสนอ:

1 เสรี ชิโนดม seree@buu.ac.th
PHP กับ Form เสรี ชิโนดม

2 ตัวแปรที่สำคัญใน Web Server
CONTENT_LENGTH CONTENT_TYPE SERVER_NAME SERVER_SOFWARE SERVER_PORT SERVER_PROTOCAL REMOTE_ADDR SCRIPT_NAME HTTP_USER_AGENT PHP Programming

3 ตัวอย่าง ไฟล์ env.php <html> <body>
<h1>Environment Variables</h1> <? print("server name is $SERVER_NAME<br>"); print("web server is $SERVER_SOFTWARE<br>"); print("web server port $SERVER_PORT<br>"); print("server protocol $SERVER_PROTOCOL<br>"); print("you come from $REMOTE_ADDR<br>"); print("your web client is $HTTP_USER_AGENT<br>"); print("this script's name $SCRIPT_NAME<br>"); print("path is $PATH_INFO<br>"); ?> </body> </html> PHP Programming

4 โปรแกรมสร้าง HTML Form
ไฟล์ submit.html <html> <head> <body> <form method="GET" action="submit.php"> Name <input type="TEXT" name="name"><br> Age <input type="TEXT" name="age" size="4"><br> <input type="submit" value="submit"> </form> </body> </html> PHP Programming

5 โปรแกรมรับข้อมูลจากFormมาประมวลผล
ไฟล์ submit.php <html> <body> <h1>Form Submit</h1> <? print("Your name is $name<br>"); print("You are $age years old.<br>"); ?> </body> </html> PHP Programming

6 เรื่องของ Post กับ Get การ Submit ฟอร์มด้วย method=post ข้อมูลที่อยู่ในฟอร์มจะถูกส่งไปเก็บที่ตัวแปรชื่อ CONTENT_LENGTH การ Submit ฟอร์มด้วย method=get ค่าที่ได้จากการ submit จะส่งไปให้ PHP โดยผ่าน URLไปเก็บไว้ในตัวแปรชื่อ QUERY_STRING และข้อมูลจะแสดงต่อท้ายURLซึ่งประกอบด้วยเครื่องหมายต่อไปนี้ ? กั้นระหว่าง URL กับข้อมูล Key = value ข้อมูลที่ส่งมา & คั่นระหว่าง Key = value + แทนที่ช่องว่าง PHP Programming

7 PHP Programming

8 การสร้างโปรแกรม login
ไฟล์ login.php <html> <body> <font size=4 face='arial'> <? if ( ( $username !="root" ) &&( $password != "ithinkso" ) ){ echo "<h1>username or password iswrong</h1>"; }else{ echo "<h1>Welcome you to my page</h1>"; } ?> </font> </body> </html> PHP Programming

9 โปรแกรมรับข้อมูลการ login
ไฟล์ login.html <html> <body> <font size=4 face='arial'> <form action="login.php" method=GET> username <input type=text name=username><br> password <input type=password name=password><br> <input type=submit value='login'> </form> </font> </body> </html> PHP Programming


ดาวน์โหลด ppt เสรี ชิโนดม seree@buu.ac.th PHP กับ Form เสรี ชิโนดม seree@buu.ac.th.

งานนำเสนอที่คล้ายกัน


Ads by Google