Advertisement
Guest User

WEB Applications

a guest
Feb 17th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.71 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <title> <?php echo "My first program"; ?>
  5.         </title>
  6.     </head>
  7.     <body>
  8.        
  9.         <?php
  10.         $x=8;
  11.         echo $x,"<br/>";
  12.         echo "Add 2: ",$x=$x+2,"<br/>";
  13.         echo "Subtract 4: ",$x=$x-4,"<br/>";
  14.         echo "Multiply by 5: " ,$x=$x*5,"<br/>";
  15.         echo "Divide by 3: ",$x=$x/3,"<br/>";
  16.         echo "Increment by 1: ",$x++,"<br/>";
  17.         echo "Decrement by 1: ",$x--,"<br/>";
  18.  
  19.  
  20.         ?>
  21. <br><br><br><br>
  22.         <?php
  23.         $x=10;
  24.         $y=7;
  25.         echo "X is: ",$x,"<br/>";
  26.         echo "Y is: ", $y,"<br/>";
  27.         if($x>$y){
  28.            
  29.  
  30.             echo "X is greater than Y";
  31.         }
  32.         else
  33.         {
  34.             echo "Y is greater than X";
  35.         }
  36.         ?>
  37.         <br><br><br><br>
  38.  
  39.         <?php
  40.  
  41.         $name = "Harry";
  42.         $age = 28;
  43.  
  44.         echo var_dump($name),"<br/>";
  45.         echo  $name," ",var_dump($age),"<br/>";
  46.         unset($age);
  47.         echo var_dump($age);
  48.          ?>
  49.  
  50. <br><br><br><br>
  51.  
  52.  
  53. <p> Please enter your name: </p>
  54. <form action="#" method = "post">
  55. <input type="text" name="asd" >
  56. <button type="submit"> Submit </button>
  57. </form>
  58. <?php
  59.    
  60.         $_POST['asd'];
  61.  
  62.         echo "Your name is ",$_POST['asd'];
  63.  
  64.  
  65.  
  66.  ?>
  67.  <br><br><br><br>
  68.  
  69.  <p> Please enter your information: </p>
  70.  <form action="#" method = "post"><br>
  71.  Name: <input type="text" name = "name" ><br><br>
  72.  Age:   <input type="text" name = "age" ><br><br>
  73.  <button type="submit"> Submit </button>
  74. </form>
  75.  
  76. <?php
  77.    
  78.         $_POST['name'];
  79.         echo "Your name is ",$_POST['name'],"<br>";
  80.         $_POST['age'];
  81.         echo "Your age is ",$_POST['age'],"<br>";
  82.  
  83.  
  84.  
  85.  ?>
  86.  
  87.  
  88.  
  89.  
  90.  
  91.        
  92.     </body>
  93. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement