check html html body form actionwelcome php methodpost
ﻣﺜﺎﻝ check. html � ﺻﻔﺤﺔ <html> <body> <form action="welcome. php" method=“post"> Name: <input type="text" name="fname" > Age: <input type="text" name="age" > <input type="submit" value="submet"> </form> </body> </html> php ﻻ ﺗﺤﺘﻮﻱ ﻋﻠﻰ 4 ﻷﻨﻬﺎ check. html ﻣﻼﺣﻈﺔ ﺗﻢ ﺗﺨﺰﻳﻦ ﻫﺬﻩ ﺍﻟﺼﻔﺤﺔ � check. php ﻭﻳﻤﻜﻦ ﺗﺨﺰﻳﻨﻬﺎ © Yacoub Al-Feef 17/04/42
)ﺗﺎﺑﻊ ﺍﻟﻤﺜﺎﻝ PHP ﻣﺜﺎﻝ ﺻﻔﺤﺔ ﺍﻝ ( ﺍﻟﺴﺎﺑﻖ Welcome. php � <html> <body> <? php $name = $_REQUEST['fname']; $age =$_REQUEST['fage']; echo "<h 1>welcome Mr. $name your age is $age Years old</h 1> "; ? > </body> </html> 5 © Yacoub Al-Feef 17/04/42
ﻣﺜﺎﻝ ﺣﺴﺎﺏ ﺍﻟﺮﺍﺗﺐ salary. html � ﺻﻔﺤﺔ <html> <body> <form action="calc. php" method=“post"> Name: <input type="text" name="fname" > Number of hour: <input type="text" name="fhour" > price pear hour: <input type="text" name="fprice" > <input type="submit" value="submet"> </form> </body> </html> 6 © Yacoub Al-Feef 17/04/42
ﻣﺜﺎﻝ ﺣﺴﺎﺏ ﺍﻟﺮﺍﺗﺐ calc. php � ﺻﻔﺤﺔ <html> <body> <? php $name = $_REQUEST['fname']; $nmber_hour = $_REQUEST['fhour']; $price = $_REQUEST['fprice']; $wage = $price * $nmber_hour; echo "<h 1>welcome Mr. $name your wage is = $wage</h 1> "; ? > </body> </html> 7 © Yacoub Al-Feef 17/04/42
if statments ﺍﻟﺠﻤﻞ ﺍﻟﺸﺮﻃﻴﺔ if ﺍﻟﻨﻤﻂ ﺍﻟﻌﺎﻡ ﻟﻠﺠﻤﻠﺔ � � The if Statement 8 if (condition){ code to be executed if condition is true; } � The if. . . else Statement if (condition) { code to be executed if condition is true; } else{ code to be executed if condition is false; } � The if. . . elseif. . else Statement if (condition){ code to be executed if condition is true; } else{ © Yacoub Al-Feef code to be executed if condition is false; } 17/04/42
ﺍﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﻤﻨﻄﻘﻴﺔ Operator == =! <> < > =< => 9 Description is equal to is not equal is greater than is less than is greater than or equal to is less than or equal to Operator && Description and || or ! not Example 5==8 returns false 5!=8 returns true 5<>8 returns true 5>8 returns false 5<8 returns true 5>=8 returns false 5<=8 returns true Example x=6 y=3 (x < 10 && y > 1) returns true x=6 y=3 (x==5 || y==5) returns false x=6 y=3 !(x==y) returns true © Yacoub Al-Feef 17/04/42
3 ﻣﺜﺎﻝ result. php ﻧﻘﻮﻡ ﺑﻌﻤﻞ ﺍﻟﺘﻌﺪﻳﻞ ﺍﻟﺘﺎﻟﻲ ﻋﻠﻰ ﺻﻔﺤﺔ � <html> <body> <? php $name = $_REQUEST['name']; $grad = $_REQUEST['grad']; if ($grad >= 90) echo " <h 1> congratulation Mr. $name you are success, your grad is A</h 1>"; elseif ($grad >= 80) echo " <h 1> congratulation Mr. $name you are success , your grad is B</h 1>"; elseif ($grad >=70) echo " <h 1> congratulation Mr. $name you are success , your grad is C</h 1>"; elseif ($grad >= 60) echo " <h 1> congratulation Mr. $name you are success , your grad is D</h 1>"; else echo " <h 1> hard luck Mr. $name you are fail, your grad is F</h 1>"; ? > </body> </html> 14 © Yacoub Al-Feef 17/04/42
3 ﻓﻲ ﺍﻟﻤﺜﺎﻝ switch ﻗﻢ ﺑﺘﻌﺪﻳﻞ ﺍﻟﻤﺜﺎﻝ ﺍﻟﺴﺎﺑﻖ ﺑﺎﺳﺘﺨﺪﺍﻡ ﺟﻤﻠﺔ 16 switch ($grad){ case $grad >= 90: echo "A"; break; case $grad >= 80: echo "B"; break; case $grad >= 70: echo "C"; break; case $grad >= 60: echo "D"; break; default: echo "F"; } © Yacoub Al-Feef � 17/04/42
ﺍﻟﻨﻘﺎﺵ 18 © Yacoub Al-Feef 17/04/42
- Slides: 19