Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Sortowanie - problem, Sortowanie
krzysiek11021
post 3.10.2016, 17:06:18
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 3.10.2016

Ostrzeżenie: (0%)
-----


Witam,
Otóż napisałem skrypt w postaci formularza, aby była możliwość napisania trzech liczb - Liczba A B i C.
Potem wyświetlają się te liczby, ale nie posortowane.

NP. Liczba A - 4 B- 1 C - 5 i chciałbym aby one były rosnąco. Próbowałem już wszystkiego...

  1. <html>
  2. <head>
  3. <title>fomularz</title>
  4. <meta charset="utf-8">
  5. <link href="css/formularz.css" type="text/css" rel="stylesheet">
  6. </head>
  7. <body>
  8. <div id="page">
  9. <h1>formularz</h1>
  10. <form action="test.php" method="get">
  11. <legend>Liczby</legend>
  12. <label for="firstnumber">Liczba A:</label>
  13. <input type="number" name="firstnumber" size="10" required="required" placeholder="Wprowadź liczbę">
  14. <label for="secondnumber">Liczba B:</label>
  15. <input type="number" name="secondnumber" size="10" required="required" placeholder="Wprowadź liczbę">
  16. <label for="thirdnumber">Liczba B:</label>
  17. <input type="number" name="thirdnumber" size="10" required="required" placeholder="Wprowadź liczbę">
  18.  
  19. <input class="end1" type="reset" value="Usuń dane">
  20. <input class="end2" type="submit" value="Wyślij dane">
  21.  
  22. </form>
  23.  
  24. </div>
  25. </body>
  26. </body>
  27. </html>


I drugi plik, który wyświetla te liczby

  1. <head>
  2. <title>Formularz</title>
  3. <meta charset="utf-8">
  4. <link href="css/formularz.css" type="text/css" rel="stylesheet">
  5. </head>
  6. <body>
  7. <div id="page">
  8. <div id="test">
  9. <?php
  10. echo "<h1>Zapisane dane formularza</h1>";
  11. echo "Liczba A ".$_GET["firstnumber"];
  12. echo "<br>\n\t";
  13. echo "Liczba B ".$_GET["secondnumber"];
  14. echo "<br>\n\t";
  15. echo "Liczba C ".$_GET["thirdnumber"];
  16. echo "<br>\n\t";
  17. ?>
  18. </div>
  19. <div id="home"><a href="./index.php">Powrót do formularza</a></div>
  20. </div>
  21. </body>
  22. </body>
  23. </html>




Go to the top of the page
+Quote Post
nospor
post 3.10.2016, 17:11:10
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Cytat
Próbowałem już wszystkiego...
Jakbys sprobowal wszystkiego to by ci w koncu zadzialalo. Nie sciemniaj wiec prosze tongue.gif

Wloz sobie te liczby do tablicy a potem posortuj tablice przez sort() a na koniec wyswietl dane z tablicy

przenosze


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 30.06.2025 - 23:55