Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Session6
1. ก F ก F PHP
HTML Form
ก F ก F PHP
projetcsoft.biz F F ก
2. Tag Form
Tag input F F F tag form
Tag form ˈ F F F F F F F tag input F
.php.php
ก F F F ก F F .php F
Form .PHP file
projetcsoft.biz F F ก
3. Tag Form
Attribute ˈ F tag form method, action
Attribute action F ก F F form
file file
Attribute method F ก F F F form ˈ GET
( F address bar F index.php?id=1&name=John )( F address bar F index.php?id=1&name=John )
POST ( F F address bar)
Tag form ˈ F tag <input type=“submit” />
projetcsoft.biz F F ก
4. Tag Form
<form action= F F ก .php method=GET
POST>
……
……
</form></form>
projetcsoft.biz F F ก
5. Tag input type submit
Tag input Attribute type ˈ submit ˈ ˁ ก
Attribute value F ˁ
Tag input type submit F F F tag form
F F F ก ˁ submit form F browser ʽ F
ก F Attribute action formก F Attribute action form
projetcsoft.biz F F ก
6. Tag Form
<form action="html_form_manage.php" method="GET">
<input type="submit" value=" ก " />
</form>
ก F F ก ˁ ก F browser ʽ F
html_form_manage.php ก F Attribute actionhtml_form_manage.php ก F Attribute action
form
projetcsoft.biz F F ก
7. ก F F F ก submit form
F F F ก submit form F F F
<form action="textbox_input_manage.php"
method="get">
<input type="text" id="textbox1" name="textbox1" />
<input type="submit" value=" ก " /><input type="submit" value=" ก " />
</form>
ก F Tag input Attribute id name
projetcsoft.biz F F ก
8. ก F F F ก submit form
ก F F ก F F F F F
textbox_input_manage.php F
<?php
$textbox1=$_GET["textbox1"];
echo $textbox1;echo $textbox1;
?>
F ก ก F ก textbox F F
textbox_input_manage.php
projetcsoft.biz F F ก
9. ก F F F ก submit form
• ก F ก $textbox1=$_GET["textbox1"];
• F F tag input F textbox1 (ก
attribute name attribute id) ก F Fattribute name attribute id) ก F F
$textbox1
• ก F address bar F ก F F GET
F ก F F F tag form attribute action
textbox_input_manage.php?textbox1=PHP
• textbox_input_manage.php ก attribute action
form action="textbox_input_manage.php"
projetcsoft.biz F F ก
10. ก F F F ก submit form
textbox1 ก กAttribute name id<input type="text"
id="textbox1" name="textbox1" />
textbox_input_manage.php?textbox1=PHP
textbox1=PHP
=PHP กก F F F F F F “PHP” textbox1=PHP กก F F F F F F “PHP” textbox1
กF ก submit
projetcsoft.biz F F ก
11. ก F F F ก submit form
ก F F ก F F address bar F Attribute Form
method="get" ˈ method="post"
projetcsoft.biz F F ก
12. ก F F F ก submit form
ก F ก attribute Form ก
method="get" ˈ method="post" F
ˈ F F ก F ก
$textbox1=$_GET["textbox1"]; ˈ
$textbox1=$_POST["textbox1"]; F$textbox1=$_POST["textbox1"]; F
projetcsoft.biz F F ก
17. ก Username Password 2
F check_login2.php
<?php
$username=$_POST["username"];
$password=$_POST["password"];
if(($username=="administrator")&&($password=="system"))
{{
echo "Login success";
}
else
{
echo "<script>location='login2.php?err=1'</script>";
exit();
}
?>
projetcsoft.biz F F ก
18. ก Username Password 2
ก F F F username password F ก F F ก
echo "<script>location='login2.php?err=1'</script>";
exit();
F browser F login2.php F F FF browser F login2.php F F F
?err=1 F
F ก F login2.php
<?php if($_GET["err"]=="1"){echo "Login error !";} ?>
F F Login error ! ก F F err=1
projetcsoft.biz F F ก
19. ก F F ก Tag select
<form method="post" action="select_input_manage.php">
<select id="number" name="number" >
<option value="">Please select umber</option>
<option value="1">One</option>
<option value="2">Two</option><option value="2">Two</option>
<option value="3">Three</option>
</select>
<input type="submit" value="OK" />
</form>
projetcsoft.biz F F ก
20. ก F F ก Tag select
ก F tag select attribute value
Attribute value F ก F F F F ก ก ก
F F F F ก ก Two F
$_POST["number"] F select_input_manage.php
F F ก ˈ 2 F value="2" ก TwoF F ก ˈ 2 F value="2" ก Two
<option value="2">Two</option>
projetcsoft.biz F F ก
21. ก F F ก Tag select
<?php
$num=$_POST["number"];
if($num=="")
{echo "You have not selected.";}
else if($num=="1")
{echo "You have selected One.";}{echo "You have selected One.";}
else if($num=="2")
{echo "You have selectedTwo.";}
else if($num=="3")
{echo "You have selectedTree.";}
?>
<br />
<a href="select_input_submit.php">Back to last page</a>
projetcsoft.biz F F ก
22. ก F F ก check box
<form method="post" action="checkbox_manage.php" >
Please select your programing langues skill.<br /><br />
<input type="checkbox" value="C++" id="cpp"
name="cpp" />C++
<input type="checkbox" value="Java" id="java"<input type="checkbox" value="Java" id="java"
name="java" />Java
<input type="checkbox" value="PHP" id="php"
name="php" />PHP
<input type="submit" value="OK" />
</form>
projetcsoft.biz F F ก
23. ก F F ก check box
F checkbox_manage.php
<?php
echo "You have ";
echo $_POST["cpp"]." ";echo $_POST["cpp"]." ";
echo $_POST["java"]." ";
echo $_POST["PHP"]." ";
echo " skill.";
?>
projetcsoft.biz F F ก
24. ก F F ก check box
ก code F F F F check box PHP F
F F ?
projetcsoft.biz F F ก
29. ก F F F F ˈ F ก F
<form action="multiply.php" method="get">
<select id="num" name="num">
<option value="2">2</option>
<option value="3">3</option>
</select></select>
<input type="submit" value="show !" /></form>
<table>
projetcsoft.biz F F ก
30. ก F F F F ˈ F ก F
<table><?php
$num=$_GET["num"];
$count=1;
while($count<=12)
{ $result=$num*$count;
echo "<tr>";echo "<td>".$num."</td>";echo "<tr>";echo "<td>".$num."</td>";
echo "<td>X</td>";
echo "<td>".$count."=</td>";
echo "<td>".$result."</td>";echo "</tr>";
$count++;}
?></table>
source code F ก slice F F
projetcsoft.biz F F ก
31. Input file
Tag name input
Type file
F ก F tag form input file F tag form F F
attribute enctype="multipart/form-data" tag form F
FF
Tag input attribute id name F F F ก tag
input
projetcsoft.biz F F ก
34. Input file
$file_1=$_FILES["file_1"];
ก F $file_1 F F input file attribute
id="file_1" name="file_1"
$file_1["name"] return F upload F
$type = substr($file_1["name"],$type = substr($file_1["name"],
strpos($file_1["name"],"."), strlen($file_1["name"])); ก
ก F upload ก F $type
projetcsoft.biz F F ก
35. Input file
$type F F F ก “.jpg” F F F F
F F link F F upload ก
F F F F F ก “.jpg”
copy($file_1["tmp_name"],"upload_img/upload_img.jpg");
F upload F F folder upload_imgF upload F F folder upload_img
F ˈ upload_img.jpg
projetcsoft.biz F F ก