Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php] nie wyskakują mi elementy (chyba zmienne)
Forum PHP.pl > Forum > PHP
ironmaiden666
pierwszy program:
Kod
<html>
<head>
<title>Checkbox Demo</title>
</head>
<body>
<h1>Checkbox Demo</h1>
<h3>Demonstrates checkboxes</h3>
<form action ="checkDemo.php">

<h3>What would you like with your order?</h3>
<ul>
<li><input type ="checkbox"
name ="chkFries"
value ="1.00">Fries
</li>
<li><input type ="checkbox"
name ="chkSoda"
value =".85">Soda
</li>
<li><input type ="checkbox"
name ="chkShake"
value ="1.30">Shake
</li>
<li><input type ="checkbox"
name ="chkKetchup"
value =".05">Ketchup
</li>
</ul>
<input type ="submit">
</form>
</body>
</html>



i druga część
Kod
<html>
<head>
<title>Checkbox Demo</title>
</head>
<body>
<h3>Demonstrates reading checkboxes</h3>
<?php
print <<<HERE
chkFries: $chkFries <br>
chkSoda: $chkSoda <br>
chkShake: $chkShake <br>
chkKetchup: $chkKetchup <br>
<hr>
HERE;
$total =0;
if (!empty($chkFries)){
("You chose Fries <br> \n");
$total =$total + $chkFries;
} // end if
if (!empty($chkSoda)){
("You chose Soda <br> \n");
$total =$total + $chkSoda;
} // end if
if (!empty($chkShake)){
("You chose Shake <br> \n");
$total =$total + $chkShake;
} // end if
if (!empty($chkKetchup)){
("You chose Ketchup <br> \n");
$total =$total + $chkKetchup;
} // end if
"The total cost is \$$total \n";
?>
</body>
</html>



i drugi program
Kod
<html>
<head>
<title>Hi User</title>
</head>
<body>
<h1>Hi User</h1>
<?php
if (empty($userName)){
print <<<HERE
<form>
Please enter your name:
<input type = "text"
name = "userName"><br>
<input type = "submit">
</form>
HERE;
} else {
print "<h3>Hi there, $userName!</h3>";
} //end
?>
</body>
</html>


jeśli chodzi o pierwszy skrypt to w 1 części jest ok
a w drugiej nie wyskakuje że np wybrałem frytki (nie ma ceny) i w ogółem również nic nie wyskakuje

w tym drugim skrypcie po wpisaniu imienia nic się nie dzieje nie ukazuje sie
hi there Arek!
k@mil
a nie powinno byc:

print "costam";

questionmark.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.