• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] Query problem, dont add

Kask

Banned User
Joined
Jan 3, 2008
Messages
376
Reaction score
1
the problem is in this code, is that supposed to fill in the form, click submit, it goes blank and does not add, and of course I ask for help because I'm new at this and something is, but not so much lol, who help me fix this little code will give you rep + hehe
PHP:
if(IsSet($_POST['lvl'])) {
		if(empty($add)) {
				$lvl = $_POST['lvl'];
		        $descrip = $_POST['descrip'];
	         	$rewards = $_POST['rewards'];
			$main_content .= '<form action="" method="post"><B>Enter Level Quest:</B><input type="textbox" name="lvl"><br>
				<B>Description from quest:</B><input type="textbox" name="descrip"><br>
				<B>Name of rewards:</B><input type="textbox" name="rewards"><br><br><input type="submit" value="Submit">
				</form></center><form action="?subtopic=questsystem&add" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
		} else {
			$SQL->query('INSERT INTO `z_quest_system` (id, lvl, descrip, rewards) VALUES (NULL, '.$lvl.', '.$descrip.', '.$rewards.')'); 
			$main_content .= '<b><center>The quest has been <i>successfully added</i>!</b></center><br>
				<form action="?subtopic=questsystem" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
		}
	}
}

Thanks =)
 
Ofcourse it doesn't add...

If $add is empty the variables $lvl and $descrip and $rewards are set, and only if the $add is not empty the variables the query executes, but the $lvl, $descrip and $rewards aren't set than.

Try:
PHP:
if(IsSet($_POST['lvl'])) {
        if(empty($add)) {
            $main_content .= '<form action="" method="post"><B>Enter Level Quest:</B><input type="textbox" name="lvl"><br>
                <B>Description from quest:</B><input type="textbox" name="descrip"><br>
                <B>Name of rewards:</B><input type="textbox" name="rewards"><br><br><input type="submit" value="Submit">
                </form></center><form action="?subtopic=questsystem&add" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
        } else {
                $lvl = $_POST['lvl'];
                $descrip = $_POST['descrip'];
                 $rewards = $_POST['rewards'];
            $SQL->query('INSERT INTO `z_quest_system` (id, lvl, descrip, rewards) VALUES (NULL, '.$lvl.', '.$descrip.', '.$rewards.')'); 
            $main_content .= '<b><center>The quest has been <i>successfully added</i>!</b></center><br>
                <form action="?subtopic=questsystem" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
        }
    }
}
 
doesnt running xd
PHP:
 if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) { 
        if(empty($add)) {
            $main_content .= '<form action="" method="post"><B>Enter Level Quest:</B><input type="textbox" name="lvl"><br>
                <B>Description from quest:</B><input type="textbox" name="descrip"><br>
                <B>Name of rewards:</B><input type="textbox" name="rewards"><br><br><input type="submit" value="Submit">
                </form></center><form action="?subtopic=questsystem&add" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
        } else {
		if(IsSet($_POST['lvl'])) {
                $lvl = $_POST['lvl'];
                $descrip = $_POST['descrip'];
                 $rewards = $_POST['rewards'];
            $SQL->query('INSERT INTO `z_quest_system` (id, lvl, descrip, rewards) VALUES (NULL, '.$lvl.', '.$descrip.', '.$rewards.')'); 
            $main_content .= '<b><center>The quest has been <i>successfully added</i>!</b></center><br>
                <form action="?subtopic=questsystem" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>';
           }
	}
 }
 
Last edited:
Back
Top