PHP gevorderde |
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../layout.css.php">
</head>
<body>
<table width="465" border="0"><tr><td>
<?
mysql_connect(host,user,pas) or die(mysql_error());
mysql_select_db(databasenaam);
$query = "SELECT * FROM members ORDER BY memberid";
$sql=mysql_query($query) or die (mysql_error());
while ($obj=mysql_fetch_object($sql)) {
$id = $obj->id;
$ruimte1 = $obj->ruimte;
$geld1 = $obj->geld;
?>
Ruimte wezens: <?php echo $ruimte1; ?><br>
Geld: <?php echo $geld1; ?><br>
<?
}
$ruimte2 = 3;
$geld2 = 200;
if(isset($_POST['submit']))
{
if(empty($ruimte2) && empty($geld2))
{
echo 'Je hebt niets ingedrukt';
}
else
{
if($_POST['type']) == 'ruimte')
{
$berekening = $ruimte1 + $ruimte2;
}
elseif($_POST['type'] == 'geld')
{
$berekening = $geld1 + $geld2;
}
}
}
?>
<table width="465">
<form method="post" action="<? $_SERVER['PHP_SELF'] ?>">
<tr>
<td>Ruimtewezens: </td>
<td><input type="radio" name="type" value="ruimte" /></td>
</tr>
<tr>
<td>Geld: </td>
<td><input type="radio" name="type" value="geld" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Probeer" /></td>
</tr>
</form>
</table>
</td></tr></table>
</body>
</html>
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="../layout.css.php"> </head> <body> <table width="465" border="0"><tr><td> <? $query = "SELECT * FROM members ORDER BY memberid"; $id = $obj->id; $ruimte1 = $obj->ruimte; $geld1 = $obj->geld; ?> Ruimte wezens: <?php echo $ruimte1; ?><br> Geld: <?php echo $geld1; ?><br> <? } $ruimte2 = 3; $geld2 = 200; if(isset($_POST['submit'])) { { echo 'Je hebt niets ingedrukt'; } else { if($_POST['type']) == 'ruimte') { $berekening = $ruimte1 + $ruimte2; } elseif($_POST['type'] == 'geld') { $berekening = $geld1 + $geld2; } } } ?> <table width="465"> <form method="post" action="<? $_SERVER['PHP_SELF'] ?>"> <tr> <td>Ruimtewezens: </td> <td><input type="radio" name="type" value="ruimte" /></td> </tr> <tr> <td>Geld: </td> <td><input type="radio" name="type" value="geld" /></td> </tr> <tr> <td colspan="2"><input type="submit" name="submit" value="Probeer" /></td> </tr> </form> </table> </td></tr></table> </body> </html>
ik krijg altijd deze error
Citaat: Parse error: parse error, unexpected T_IS_EQUAL in /usr/home/mette/domains/mette.zoef-design.be/public_html/RPG/taken/Kl.php on line 34
Kan er iemand helpen?
DENMETTE
|