Is that necessary?
The code goes like:
while ( $playerhp >= 0 && $monsterhp >= 0 ) {
echo "$playername attacks $monstername for ".$playerdamage." damage! <br>";
echo "$monstername attacks $playername for ".$monsterdamage." damage! <br>";
$monsterhp -= $playerdamage;
$playerhp -= $monsterdamage;
mysql_query("UPDATE users SET hp = {$playerhp} WHERE id = {$_SESSION['user_id']}");
}So instead I'd want a button:
[how-to]BUTTON ("Attack!", onclick run:)[/how-to]
if ( $playerhp >= 0 && $monsterhp >= 0 ) {
echo "$playername attacks $monstername for ".$playerdamage." damage! <br>";
echo "$monstername attacks $playername for ".$monsterdamage." damage! <br>";
$monsterhp -= $playerdamage;
$playerhp -= $monsterdamage;
mysql_query("UPDATE users SET hp = {$playerhp} WHERE id = {$_SESSION['user_id']}");
} else {
-check which one has >= 0 hp and echo a "You died" or "monster died" message-
}Is that possible with HTML/PHP, or do I need to use something like javascript or ajax?
EDIT: I took a look at Ajax and it seems that's the best (and prolly only) way to do this, I'll read a tutorial or two, Ajax surely seems like something I could make a BIG use of. Thanks for pointing that out, thorpe

Also, if you have any advice, I'll be glad to hear since I don't know Ajax at all.
