Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Generator., Będę wdzięczny za każdą pomoc.
adrix88
post
Post #1





Grupa: Zarejestrowani
Postów: 45
Pomógł: 1
Dołączył: 16.11.2007

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


Witam, zwracam się do was z prośbą o pomoc w napisaniu skryptu dzięki któremu po wpisaniu cyfr w pola o nazwie [ Wartość A i Wartość B ], wartości od 1-5 same się obliczą wg. podanych działań. Ma to wyglądać mniej-więcej tak:

Wartość A Wartość B

Wartość1 = Wartość B x 900 / 8
Wartość2 = Wartość A x 900 / 8
Wartość3 = Wartość1 / 25
Wartość4 = Wartość2 / 175
Wartość5 = 1 / Wartość 4


Z góry dzięki za pomoc.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nevt
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 595
Pomógł: 282
Dołączył: 24.09.2007
Skąd: Reda, Pomorskie.

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


Proszę (plikk zapisz pod nazwą oblicz.php):
  1. <?php
  2. $a = isset($_GET['a']) ? $_GET['a'] : '';
  3. $b = isset($_GET['b']) ? $_GET['b'] : '';
  4. $html = '<html><body><p>Podaj liczby:</p><hr /><form action="oblicz.php">';
  5. $html .= '<p>Wartosc A:<br /><input type="text" name="a" value="'.$a.'" /></p>';
  6. $html .= '<p>Wartosc B:<br /><input type="text" name="b" value="'.$b.'" /></p>';
  7. $html .= '<p><input type="submit" value="0blicz" /></p></form><hr />';
  8. if(is_numeric($a) and is_numeric($b))
  9. {
  10. $html .= '<p>Wynik 1 = '.(string)($w1 = $b*900/8).'</p>';
  11. $html .= '<p>Wynik 2 = '.(string)($w2 = $a*900/8).'</p>';
  12. $html .= '<p>Wynik 3 = '.(string)($w3 = $w1/25).'</p>';
  13. $html .= '<p>Wynik 4 = '.(string)($w4 = $w2/175).'</p>';
  14. $html .= '<p>Wynik 5 = '.(string)($w5 = 1/$w4).'</p>';
  15. }
  16. $html .= '</body></html>';
  17. echo $html;
  18. ?>


Ten post edytował nevt 16.11.2007, 19:15:57
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 11.10.2025 - 02:33