GET POST 12 http localhostx php a5 form

  • Slides: 13
Download presentation

GET & POST (1/2) http: //localhost/x. php? a=5 >form action=x. php method=get< >input name=a><input

GET & POST (1/2) http: //localhost/x. php? a=5 >form action=x. php method=get< >input name=a><input type=submit></form< ? > response. write($_GET"}a; ({" response. write($_GET"]a; ([" <? http: //www. thaiall. com/php Page: 3

GET & POST (2/2) >form action=‘y. php? a=6’ method=post< >input name=b><input type=submit></form< ? >

GET & POST (2/2) >form action=‘y. php? a=6’ method=post< >input name=b><input type=submit></form< ? > $a = $_GET"}a"} + $_REQUEST"}b; {" $b = $_POST"}b; {" response. write($a & $b( <? http: //www. thaiall. com/php Page: 4

การทำงานแบบตามลำดบ >body bgcolor=yellow< >font color=#ddffdd< ? > echo 5; echo "abc; " <? >hr<

การทำงานแบบตามลำดบ >body bgcolor=yellow< >font color=#ddffdd< ? > echo 5; echo "abc; " <? >hr< welcome to my webpage http: //www. thaiall. com/php Page: 5

การทำงานแบบตามลำดบ ? > echo “<body bgcolor=yellow< >font color=#ddffdd; ”< echo 5; echo “abc >hr<

การทำงานแบบตามลำดบ ? > echo “<body bgcolor=yellow< >font color=#ddffdd; ”< echo 5; echo “abc >hr< welcome to my webpage; ” <? http: //www. thaiall. com/php Page: 6

คำสง for เพอ การทำซำ (1/2( ? > $n = $_REQUEST["a; [" for ($i=1; $i<=$n;

คำสง for เพอ การทำซำ (1/2( ? > $n = $_REQUEST["a; [" for ($i=1; $i<=$n; $i}(++ echo $i. "<br; "< { <? http: //www. thaiall. com/php Page: 8

คำสง for เพอ การทำซำ (2/2( ? > srand; () for ($i=1; $i<=5; $i}(++ echo

คำสง for เพอ การทำซำ (2/2( ? > srand; () for ($i=1; $i<=5; $i}(++ echo $i; ”: ", echo rand(0, 100; ( echo "<br; "< { <? http: //www. thaiall. com/php Page: 9

คำสง while เพอ การทำซำ >pre< ? > $i=1; while ($i<=5}( echo $i, ": ",

คำสง while เพอ การทำซำ >pre< ? > $i=1; while ($i<=5}( echo $i, ": ", ord($i), "n; " $ i; ++ { <? http: //www. thaiall. com/php Page: 10

คำสง while กบอารเรย >pre< ? > $ar = array(5, 2, 6, 9, 4; (

คำสง while กบอารเรย >pre< ? > $ar = array(5, 2, 6, 9, 4; ( $i=0; while ($i<=}(4 echo $i, ": ", $ar[$i], "n; " $ i; ++ { <? http: //www. thaiall. com/php Page: 11

คำสง foreach กบ อารเรย >pre< ? > $ar = array(5, 2, 6, 9, 4;

คำสง foreach กบ อารเรย >pre< ? > $ar = array(5, 2, 6, 9, 4; ( foreach($ar as $v}( echo $v, "n; " { <? http: //www. thaiall. com/php Page: 12

แสดงขอมลสลบส >pre< 5 ? > 2 $ar = array(5, 2, 6, 9, 4; (

แสดงขอมลสลบส >pre< 5 ? > 2 $ar = array(5, 2, 6, 9, 4; ( 6 $i=0; foreach($ar as $v}( 9 if ($i++ % 2 == 0 ( 4 echo "$vn; " else echo "<font color=red>$v</font>n; " { <? http: //www. thaiall. com/php Page: 13