Differences

This shows you the differences between two versions of the page.

Link to this comparison view

amdelc_08 [2017-09-19 15:55]
Anders Mosshäll
amdelc_08 [2022-07-18 13:20]
Line 1: Line 1:
-====== Del c - uppgift 9 ====== 
  
- 
- 
-<code php> 
- 
-<?php 
-include ("head.php"); 
- 
- 
-if (isset($_POST['t1'])){ 
- if ($_POST['t2'] > $_POST['t1']){ //Är andra talet större än det första? Byt i så fall plats. 
- $temp = $_POST['t1']; 
- $_POST['t1'] = $_POST['t2']; 
- $_POST['t2'] = $temp; 
- } 
-  
- if ($_POST['t3'] > $_POST['t2']){ //Är tredje talet större än det andra? Byt i så fall plats. 
- $temp = $_POST['t2']; 
- $_POST['t2'] = $_POST['t3']; 
- $_POST['t3'] = $temp; 
- } 
-  
- if ($_POST['t2'] > $_POST['t1']){ //Testa igen det andra och första talen. (Förändring kan ha skett ovan) 
- $temp = $_POST['t1']; 
- $_POST['t1'] = $_POST['t2']; 
- $_POST['t2'] = $temp; 
- } 
-   
-  echo "Talen störst - minst: "; 
-  echo $_POST['t1']." - ".$_POST['t2']." - ".$_POST['t3']; 
-} 
- 
- 
- 
-echo "<br><br>"; 
- 
-?> 
- 
-<form method = "POST"> 
-         Tal1: <input type = "text" name = "t1"> 
-         Tal2: <input type = "text" name = "t2"> 
-         Tal3: <input type = "text" name = "t3"> 
-         <input type = "submit" value="Sortera"> 
-      </form> 
- 
- 
-<?php  
- 
-include ("foot.php"); 
-?> 
-</code>