dodanie obslugi formularza w php
This commit is contained in:
@@ -1,3 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
$waga = (float)$_POST['waga'];
|
||||||
|
$wzrost = (float)$_POST['wzrost'];
|
||||||
|
$wiek = (int)$_POST['wiek'];
|
||||||
|
$plec = $_POST['plec'];
|
||||||
|
$cel = $_POST['cel'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="pl">
|
<html lang="pl">
|
||||||
<head>
|
<head>
|
||||||
@@ -9,8 +20,8 @@
|
|||||||
<form method="post">
|
<form method="post">
|
||||||
<div>
|
<div>
|
||||||
<label>Płeć:</label>
|
<label>Płeć:</label>
|
||||||
<input type="radio" name="plec" value="m" required> Mężczyzna
|
<input type="radio" name="plec" value="m"> Mężczyzna
|
||||||
<input type="radio" name="plec" value="k" required> Kobieta
|
<input type="radio" name="plec" value="k"> Kobieta
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label>Waga (kg):</label>
|
<label>Waga (kg):</label>
|
||||||
@@ -34,5 +45,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<button type="submit">Oblicz zapotrzebowanie kaloryczne</button>
|
<button type="submit">Oblicz zapotrzebowanie kaloryczne</button>
|
||||||
</form>
|
</form>
|
||||||
|
<?php if($plec): ?>
|
||||||
|
<div class="wynik">
|
||||||
|
<?php echo $plec; ?> test.
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user