SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
ก F ก F PHP
HTML Form
ก F ก F PHP
projetcsoft.biz F F ก
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 ก
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 ก
Tag Form
<form action= F F ก .php method=GET
POST>
……
……
</form></form>
projetcsoft.biz F F ก
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 ก
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 ก
ก 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 ก
ก 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 ก
ก 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 ก
ก 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 ก
ก F F F ก submit form
ก F F ก F F address bar F Attribute Form
method="get" ˈ method="post"
projetcsoft.biz F F ก
ก 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 ก
ก F F F ก submit form
projetcsoft.biz F F ก
ก Username Password
<form action="check_login.php" method="post">
<table><tr><td align="right">Username:</td>
<td><input type="text" id="username" name="username"
/></td>
</tr><tr><td align="right">Password:</td>
<td><td>
<input type="password" id="password" name="password" />
</td></tr><tr><td align="right"></td>
<td><input type="submit" value="Login" /></td>
</tr>
</table>
</form>
projetcsoft.biz F F ก
ก Username Password
F check_login.php
<?php
$username=$_POST["username"];
$password=$_POST["password"];
if(($username=="administrator")&&($password=="system"))
{{
echo "Login success";
}
else
{
echo "Login error ! <br />";
echo "<a href="login.php">Click to login agian</a>";
}
?>
projetcsoft.biz F F ก
ก Username Password 2
<?php if($_GET["err"]=="1"){echo "Login error !";} ?>
<form action="check_login2.php" method="post">
<table><tr><td align="right">Username:</td>
<td><input type="text" id="username" name="username"
/></td>
</tr><tr><td align="right">Password:</td>
<td>
<input type="password" id="password" name="password" />
</td></tr><tr><td align="right"></td>
<td><input type="submit" value="Login" /></td>
</tr>
</table>
</form>
projetcsoft.biz F F ก
ก 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 ก
ก 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 ก
ก 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 ก
ก 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 ก
ก 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 ก
ก 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 ก
ก 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 ก
ก F F ก check box
ก code F F F F check box PHP F
F F ?
projetcsoft.biz F F ก
ก ก,
<form method="post" action="calculator_result.php">
<input type="text" id="num1" name="num1" size="3"
/>
<select id="opp" name="opp"><option
value="add">+</option><option value="sub">-value="add">+</option><option value="sub">-
</option></select>
<input type="text" id="num2" name="num2" size="3"
/>
<input type="submit" value="=" size="100"/>
</form>
projetcsoft.biz F F ก
ก ก,
<?php
$num1=$_POST["num1"];
$num2=$_POST["num2"];
if($_POST["opp"]=="add")
{$result=$num1+$num2;{$result=$num1+$num2;
echo $num1."+".$num2." = ".$result;}
else if($_POST["opp"]=="sub")
{$result=$num1-$num2;
echo $num1."-".$num2." = ".$result;
}
?>
projetcsoft.biz F F ก
ก ก, 2
<form method="post" action="calculator_result2.php">
<input type="text" id="num1" name="num1" /><br />
<input type="checkbox" value="add" id="op1"
name="op1" />+<br />
<input type="checkbox" value="sub" id="op2"<input type="checkbox" value="sub" id="op2"
name="op2" />-<br />
<input type="text" id="num2" name="num2" /><br />
<input type="submit" value="=" />
</form>
projetcsoft.biz F F ก
ก ก, 2
<?php
$num1=$_POST["num1"];
$num2=$_POST["num2"];
if($_POST["op1"]=="add")
{ $result=$num1+$num2;
echo $num1."+".$num2."=".$result."<br />";echo $num1."+".$num2."=".$result."<br />";
}
if($_POST["op2"]=="sub")
{ $result=$num1-$num2;
echo $num1."-".$num2."=".$result."<br />";
}
?>
projetcsoft.biz F F ก
ก 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 ก
ก 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 ก
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 ก
Input file
<form action="upload_file.php" method="post"
enctype="multipart/form-data" >
upload file(.jpg)
<input type="file" name="file_1" id="file_1" />
<input type="submit" value="upload" /><input type="submit" value="upload" />
</form>
projetcsoft.biz F F ก
Input file
<?php
$file_1=$_FILES["file_1"];
$type = substr($file_1["name"], strpos($file_1["name"],"."),
strlen($file_1["name"])); $type =strtolower($type );
if($type!= ".jpg")
{echo "Please select .jpg file<br />";{echo "Please select .jpg file<br />";
echo "<a href="input_file.php" >Click to upload agian</a>";
} else{
copy($file_1["tmp_name"],"upload_img/upload_img.jpg");
echo "<img src="upload_img/upload_img.jpg" />";
}
?>
projetcsoft.biz F F ก
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 ก
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 ก

Contenu connexe

Tendances

PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)Kana Natsuno
 
Laravel Poznań Meetup #2 - Wykorzystanie FormRequest w Laravelu
Laravel Poznań Meetup #2 - Wykorzystanie FormRequest w LaraveluLaravel Poznań Meetup #2 - Wykorzystanie FormRequest w Laravelu
Laravel Poznań Meetup #2 - Wykorzystanie FormRequest w LaraveluHighSolutions Sp. z o.o.
 
High-level Web Testing
High-level Web TestingHigh-level Web Testing
High-level Web Testingpetersergeant
 
Php Calling Operators
Php Calling OperatorsPhp Calling Operators
Php Calling Operatorsmussawir20
 
Guía de uso de ISI WOK (ISI Web of Knowledge)
Guía de uso de ISI WOK (ISI Web of Knowledge)Guía de uso de ISI WOK (ISI Web of Knowledge)
Guía de uso de ISI WOK (ISI Web of Knowledge)Marta Domínguez-Senra
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using CodeceptionJeroen van Dijk
 
Simple Blue Blog Template XML 的副本
Simple Blue Blog Template XML 的副本Simple Blue Blog Template XML 的副本
Simple Blue Blog Template XML 的副本a5494535
 
Can WordPress really do that? A case study of vierderduer.no
Can WordPress really do that? A case study of vierderduer.noCan WordPress really do that? A case study of vierderduer.no
Can WordPress really do that? A case study of vierderduer.noMorten Rand-Hendriksen
 
Cloud Entwicklung mit Apex
Cloud Entwicklung mit ApexCloud Entwicklung mit Apex
Cloud Entwicklung mit ApexAptly GmbH
 
TDC2016SP - Trilha Developing for Business
TDC2016SP - Trilha Developing for BusinessTDC2016SP - Trilha Developing for Business
TDC2016SP - Trilha Developing for Businesstdc-globalcode
 
Developing applications for performance
Developing applications for performanceDeveloping applications for performance
Developing applications for performanceLeon Fayer
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkDirk Haun
 
Rails view chapte 5 - form
Rails view   chapte 5 - formRails view   chapte 5 - form
Rails view chapte 5 - formThaichor Seng
 
Web осень 2012 лекция 7
Web осень 2012 лекция 7Web осень 2012 лекция 7
Web осень 2012 лекция 7Technopark
 

Tendances (20)

Os Nixon
Os NixonOs Nixon
Os Nixon
 
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
 
Laravel Poznań Meetup #2 - Wykorzystanie FormRequest w Laravelu
Laravel Poznań Meetup #2 - Wykorzystanie FormRequest w LaraveluLaravel Poznań Meetup #2 - Wykorzystanie FormRequest w Laravelu
Laravel Poznań Meetup #2 - Wykorzystanie FormRequest w Laravelu
 
Php Rss
Php RssPhp Rss
Php Rss
 
High-level Web Testing
High-level Web TestingHigh-level Web Testing
High-level Web Testing
 
Php Calling Operators
Php Calling OperatorsPhp Calling Operators
Php Calling Operators
 
Guía de uso de ISI WOK (ISI Web of Knowledge)
Guía de uso de ISI WOK (ISI Web of Knowledge)Guía de uso de ISI WOK (ISI Web of Knowledge)
Guía de uso de ISI WOK (ISI Web of Knowledge)
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using Codeception
 
Simple Blue Blog Template XML 的副本
Simple Blue Blog Template XML 的副本Simple Blue Blog Template XML 的副本
Simple Blue Blog Template XML 的副本
 
Can WordPress really do that? A case study of vierderduer.no
Can WordPress really do that? A case study of vierderduer.noCan WordPress really do that? A case study of vierderduer.no
Can WordPress really do that? A case study of vierderduer.no
 
Cloud Entwicklung mit Apex
Cloud Entwicklung mit ApexCloud Entwicklung mit Apex
Cloud Entwicklung mit Apex
 
TDC2016SP - Trilha Developing for Business
TDC2016SP - Trilha Developing for BusinessTDC2016SP - Trilha Developing for Business
TDC2016SP - Trilha Developing for Business
 
Developing for Business
Developing for BusinessDeveloping for Business
Developing for Business
 
Developing applications for performance
Developing applications for performanceDeveloping applications for performance
Developing applications for performance
 
FQL Overview
FQL OverviewFQL Overview
FQL Overview
 
Using an ARLA Agent
Using an ARLA AgentUsing an ARLA Agent
Using an ARLA Agent
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
symfony & jQuery (PUG)
symfony & jQuery (PUG)symfony & jQuery (PUG)
symfony & jQuery (PUG)
 
Rails view chapte 5 - form
Rails view   chapte 5 - formRails view   chapte 5 - form
Rails view chapte 5 - form
 
Web осень 2012 лекция 7
Web осень 2012 лекция 7Web осень 2012 лекция 7
Web осень 2012 лекция 7
 

Similaire à Session6

Zen Coding Cheat Sheet
Zen Coding Cheat SheetZen Coding Cheat Sheet
Zen Coding Cheat SheetFaysal Shahi
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2RORLAB
 
HTML5 workshop, forms
HTML5 workshop, formsHTML5 workshop, forms
HTML5 workshop, formsRobert Nyman
 
Bad Form @ Form, Function & Class 2016
Bad Form @ Form, Function & Class 2016Bad Form @ Form, Function & Class 2016
Bad Form @ Form, Function & Class 2016cliener
 
Alfresco Forms Service Deep Dive
Alfresco Forms Service Deep DiveAlfresco Forms Service Deep Dive
Alfresco Forms Service Deep DiveAlfresco Software
 
Facebook Development with Zend Framework
Facebook Development with Zend FrameworkFacebook Development with Zend Framework
Facebook Development with Zend FrameworkBrett Harris
 
04 Html Form Get Post Login System
04 Html Form Get Post Login System04 Html Form Get Post Login System
04 Html Form Get Post Login SystemGeshan Manandhar
 
05 File Handling Upload Mysql
05 File Handling Upload Mysql05 File Handling Upload Mysql
05 File Handling Upload MysqlGeshan Manandhar
 
HSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART III.pdf
HSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART III.pdfHSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART III.pdf
HSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART III.pdfAAFREEN SHAIKH
 
Practical PHP by example Jan Leth-Kjaer
Practical PHP by example   Jan Leth-KjaerPractical PHP by example   Jan Leth-Kjaer
Practical PHP by example Jan Leth-KjaerCOMMON Europe
 
HTML::FormHandler
HTML::FormHandlerHTML::FormHandler
HTML::FormHandlerbbeeley
 

Similaire à Session6 (20)

5.1 html lec 5
5.1 html lec 55.1 html lec 5
5.1 html lec 5
 
Zencoding cheatsheet, ayuda Memoria
Zencoding cheatsheet, ayuda MemoriaZencoding cheatsheet, ayuda Memoria
Zencoding cheatsheet, ayuda Memoria
 
Zen Coding Cheat Sheet
Zen Coding Cheat SheetZen Coding Cheat Sheet
Zen Coding Cheat Sheet
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2
 
HTML5 workshop, forms
HTML5 workshop, formsHTML5 workshop, forms
HTML5 workshop, forms
 
Bad Form @ Form, Function & Class 2016
Bad Form @ Form, Function & Class 2016Bad Form @ Form, Function & Class 2016
Bad Form @ Form, Function & Class 2016
 
Web I - 04 - Forms
Web I - 04 - FormsWeb I - 04 - Forms
Web I - 04 - Forms
 
Alfresco Forms Service Deep Dive
Alfresco Forms Service Deep DiveAlfresco Forms Service Deep Dive
Alfresco Forms Service Deep Dive
 
Facebook Development with Zend Framework
Facebook Development with Zend FrameworkFacebook Development with Zend Framework
Facebook Development with Zend Framework
 
4.1 html lec 4
4.1 html lec 44.1 html lec 4
4.1 html lec 4
 
04 Html Form Get Post Login System
04 Html Form Get Post Login System04 Html Form Get Post Login System
04 Html Form Get Post Login System
 
05 File Handling Upload Mysql
05 File Handling Upload Mysql05 File Handling Upload Mysql
05 File Handling Upload Mysql
 
Cmsc 100 (web forms)
Cmsc 100 (web forms)Cmsc 100 (web forms)
Cmsc 100 (web forms)
 
HSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART III.pdf
HSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART III.pdfHSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART III.pdf
HSC INFORMATION TECHNOLOGY CHAPTER 1 ADVANCED WEB DESIGNING PART III.pdf
 
Practical PHP by example Jan Leth-Kjaer
Practical PHP by example   Jan Leth-KjaerPractical PHP by example   Jan Leth-Kjaer
Practical PHP by example Jan Leth-Kjaer
 
phptut2
phptut2phptut2
phptut2
 
phptut2
phptut2phptut2
phptut2
 
phptut2
phptut2phptut2
phptut2
 
phptut2
phptut2phptut2
phptut2
 
HTML::FormHandler
HTML::FormHandlerHTML::FormHandler
HTML::FormHandler
 

Dernier

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Dernier (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
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 ก
  • 13. ก F F F ก submit form projetcsoft.biz F F ก
  • 14. ก Username Password <form action="check_login.php" method="post"> <table><tr><td align="right">Username:</td> <td><input type="text" id="username" name="username" /></td> </tr><tr><td align="right">Password:</td> <td><td> <input type="password" id="password" name="password" /> </td></tr><tr><td align="right"></td> <td><input type="submit" value="Login" /></td> </tr> </table> </form> projetcsoft.biz F F ก
  • 15. ก Username Password F check_login.php <?php $username=$_POST["username"]; $password=$_POST["password"]; if(($username=="administrator")&&($password=="system")) {{ echo "Login success"; } else { echo "Login error ! <br />"; echo "<a href="login.php">Click to login agian</a>"; } ?> projetcsoft.biz F F ก
  • 16. ก Username Password 2 <?php if($_GET["err"]=="1"){echo "Login error !";} ?> <form action="check_login2.php" method="post"> <table><tr><td align="right">Username:</td> <td><input type="text" id="username" name="username" /></td> </tr><tr><td align="right">Password:</td> <td> <input type="password" id="password" name="password" /> </td></tr><tr><td align="right"></td> <td><input type="submit" value="Login" /></td> </tr> </table> </form> 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 ก
  • 25. ก ก, <form method="post" action="calculator_result.php"> <input type="text" id="num1" name="num1" size="3" /> <select id="opp" name="opp"><option value="add">+</option><option value="sub">-value="add">+</option><option value="sub">- </option></select> <input type="text" id="num2" name="num2" size="3" /> <input type="submit" value="=" size="100"/> </form> projetcsoft.biz F F ก
  • 26. ก ก, <?php $num1=$_POST["num1"]; $num2=$_POST["num2"]; if($_POST["opp"]=="add") {$result=$num1+$num2;{$result=$num1+$num2; echo $num1."+".$num2." = ".$result;} else if($_POST["opp"]=="sub") {$result=$num1-$num2; echo $num1."-".$num2." = ".$result; } ?> projetcsoft.biz F F ก
  • 27. ก ก, 2 <form method="post" action="calculator_result2.php"> <input type="text" id="num1" name="num1" /><br /> <input type="checkbox" value="add" id="op1" name="op1" />+<br /> <input type="checkbox" value="sub" id="op2"<input type="checkbox" value="sub" id="op2" name="op2" />-<br /> <input type="text" id="num2" name="num2" /><br /> <input type="submit" value="=" /> </form> projetcsoft.biz F F ก
  • 28. ก ก, 2 <?php $num1=$_POST["num1"]; $num2=$_POST["num2"]; if($_POST["op1"]=="add") { $result=$num1+$num2; echo $num1."+".$num2."=".$result."<br />";echo $num1."+".$num2."=".$result."<br />"; } if($_POST["op2"]=="sub") { $result=$num1-$num2; echo $num1."-".$num2."=".$result."<br />"; } ?> 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 ก
  • 32. Input file <form action="upload_file.php" method="post" enctype="multipart/form-data" > upload file(.jpg) <input type="file" name="file_1" id="file_1" /> <input type="submit" value="upload" /><input type="submit" value="upload" /> </form> projetcsoft.biz F F ก
  • 33. Input file <?php $file_1=$_FILES["file_1"]; $type = substr($file_1["name"], strpos($file_1["name"],"."), strlen($file_1["name"])); $type =strtolower($type ); if($type!= ".jpg") {echo "Please select .jpg file<br />";{echo "Please select .jpg file<br />"; echo "<a href="input_file.php" >Click to upload agian</a>"; } else{ copy($file_1["tmp_name"],"upload_img/upload_img.jpg"); echo "<img src="upload_img/upload_img.jpg" />"; } ?> 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 ก