Here is my error:
Notice: Undefined index: inn in C:\Apache\Apache2\htdocs\inn.php on line 14
If anyone could please tell me what the problem is i would really appreciate it.
Thanks in advance! Here is the code:
<?
session_start();
?>
<?
$db_user = 'Berone';
$db_pass = 'moltres';
$connection = mysql_connect('localhost', $db_user, $db_pass) or die(mysql_error());
mysql_select_db('Berone', $connection) or die(mysql_error());
mysql_connect('localhost', $db_user, $db_pass) or die(mysql_error());
mysql_select_db('Berone', $connection) or die(mysql_error());
//******************************************************************************************
if ($_POST['inn'] == "stay") {
if ($Level == 1) { if ($gold >= 25) {
$gold = $gold -25;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 25) {
print "You do not have enough gold to stay at the inn!<br>";}
} elseif ($Level == 2) { if ($gold >= 50) {
$gold = $gold -50;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 50) {
print "You do not have enough gold to stay at the inn!<br>";}
} elseif ($Level == 3) { if ($gold >= 75) {
$gold = $gold -75;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 75) {
print "You do not have enough gold to stay at the inn!<br>";}
} elseif ($Level == 4) { if ($gold >= 125) {
$gold = $gold -125;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 125) {
print "You do not have enough gold to stay at the inn!<br>";} }
elseif ($Level == 5) { if ($gold >= 125) {
$gold = $gold -125;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 125) {
print "You do not have enough gold to stay at the inn!<br>";}
} elseif ($Level == 6) { if ($gold >= 170) {
$gold = $gold -170;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 170) {
print "You do not have enough gold to stay at the inn!<br>";}
} elseif ($Level == 7) { if ($gold >= 220) {
$gold = $gold - 220;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 220) {
print "You do not have enough gold to stay at the inn!<br>";}
} elseif ($Level == 8) { if ($gold >= 260) {
$gold = $gold -260;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 260) {
print "You do not have enough gold to stay at the inn!<br>";}
} elseif ($Level == 9) { if ($gold >= 300) {
$gold = $gold -300;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 300) {
print "You do not have enough gold to stay at the inn!<br>";}
} elseif ($Level == 10) { if ($gold >= 400) {
$gold = $gold -400;
mysql_query( "UPDATE users SET gold = '$gold' where user_name='$user_name'" );
print "Thank you $user_name for staying at the inn.<br>";
} elseif ($gold < 400) {
print "You do not have enough gold to stay at the inn!<br>";}
}
}
//******************************************************************************************
?>
<?
if ($Level == 1) {
print "In your hand you have $gold gold.<br>";
print "You can stay at the inn for 25 gold.";
}
//*****************************************************************
global $PHP_SELF;
print"<form name=\"inn\" method=\"post\" name=\"inn\" >
<p>
<select name=\"inn\">
<option value=\"stay\" selected>Stay</option>
<option value=\"leave\">Leave</option>
</select>
</p>
<p>
<input type=\"submit\" name=\"Submit\" value=\"Submit\">
</p>
</form>";
?>