Hospital
Posted: Thu Oct 29, 2009 8:05 pm
okay so i decided to make an hospital
but then i got to a point where i didn't know how to continue
i cant get the health to recover to maxhp by clicking on a button
this is the code...any1 can help

but then i got to a point where i didn't know how to continue
i cant get the health to recover to maxhp by clicking on a button
this is the code...any1 can help
Code: Select all
<title>Hospital</title
><link href="style.css" rel="stylesheet" type="text/css">
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
?>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
?>
<div id="bank">
<table width="100%" border="1" cellspacing="0" cellpadding="0"">
<tr>
<td width="79%" height="48">Health</td>
<td width="21%"><center>
<input type="submit" name="heal_hp" value="Recover"></center>
</td>
</tr>
<tr>
<td height="48">Spell Points</td>
<td><center>
<input type="submit" name="heal_sp" value="Recover"></center>
</form>
</fieldset>
</td>
</table>
</div>
<?php
$playerhealth = $playerinfo3['maxhp'];
$playerspell = $playerinfo3['maxspoints'];
$playerhp = $playerinfo3['hpoints'];
$playersp = $playerinfo3['spoints'];
?>
<?php
if(isset($_POST['heal_hp']))
{
$newgold = ($playerinfo3['gold'] - 50 );
$healedplayer = "update players set hpoints='$playerhealth', gold='$newgold' where name='$player'";
mysql_query($healedplayer) or die("could not update health");
}
else
echo"U have full health!";
}
?>
