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>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
@@ -9,8 +20,8 @@
|
||||
<form method="post">
|
||||
<div>
|
||||
<label>Płeć:</label>
|
||||
<input type="radio" name="plec" value="m" required> Mężczyzna
|
||||
<input type="radio" name="plec" value="k" required> Kobieta
|
||||
<input type="radio" name="plec" value="m"> Mężczyzna
|
||||
<input type="radio" name="plec" value="k"> Kobieta
|
||||
</div>
|
||||
<div>
|
||||
<label>Waga (kg):</label>
|
||||
@@ -34,5 +45,10 @@
|
||||
</div>
|
||||
<button type="submit">Oblicz zapotrzebowanie kaloryczne</button>
|
||||
</form>
|
||||
<?php if($plec): ?>
|
||||
<div class="wynik">
|
||||
<?php echo $plec; ?> test.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user