if(preg_match("/norm/i", $drop) && $ruavalue === "0" || $ruavalue === "2")
{
echo '<form action="" method="post">';
echo "<input name=\"drop1\" type=hidden value='".$drop."'>";
echo "<input name=\"boss\" type=hidden value='".$_POST['tier_two']."'>";
echo "<input name=\"main\" type=hidden value='".$_COOKIE['ID_my_site']."'>";
echo '<input type="submit" name="ruasubmit" value="RUA!" />';
echo '</form>';
Echo "drop = ";
echo $drop;
echo '<p>';
echo "ruavalue = ";
echo $ruavalue;
} elseif(preg_match("/hc/i", $drop) && $ruavalue === "0" || $ruavalue === "1") {
echo '<form action="" method="post">';
echo "<input name=\"drop1\" type=hidden value='".$drop."'>";
echo "<input name=\"boss\" type=hidden value='".$_POST['tier_two']."'>";
echo "<input name=\"main\" type=hidden value='".$_COOKIE['ID_my_site']."'>";
echo '<input type="submit" name="ruasubmit" value="RUA!" />';
echo '</form>';
Echo "drop = ";
echo $drop;
echo '<p>';
echo "ruavalue = ";
echo $ruavalue;
} else {
echo "You Have RUA'ed To This Boss";
}
if (isset($_POST['ruasubmit'])) {
if (preg_match("/norm/i", $drop)) {
//Normal Value Is 0 - No RUA Submitted
if ($ruavalue == 0) {
$ruaboss = $_POST['boss'];
$ruauser = $_POST['main'];
$ruasql = "UPDATE `RUASEXCELL` SET `$ruaboss`=1 WHERE Username = '$ruauser'";
$add_rua = mysql_query($ruasql);
}
//Nomral Value Is 1 - Normal RUA Submitted
elseif ($ruavalue == 1) {
echo "nothing to do";
}
//Normal Value Is 2 - Heroic RUA Submitted
elseif ($ruavalue == 2) {
$ruaboss = $_POST['boss'];
$ruauser = $_POST['main'];
$ruasql = "UPDATE `RUASEXCELL` SET `$ruaboss`=3 WHERE Username = '$ruauser'";
$add_rua = mysql_query($ruasql);
}
//Nomral Value Is 3 - Normal & Heroic RUA Submitted
elseif ($ruavalue == 3) {
echo "nothing to do";
}
}
elseif (preg_match("/hc/i", $drop)) {
//Heroic Value Is 0 - No RUA Submitted
if ($ruavalue == 0) {
$ruaboss = $_POST['boss'];
$ruauser = $_POST['main'];
$ruasql = "UPDATE `RUASEXCELL` SET `$ruaboss`=2 WHERE Username = '$ruauser'";
$add_rua = mysql_query($ruasql);
}
//Heroic Value Is 1 - Normal RUA Submitted
elseif ($ruavalue == 1) {
$ruaboss = $_POST['boss'];
$ruauser = $_POST['main'];
$ruasql = "UPDATE `RUASEXCELL` SET `$ruaboss`=3 WHERE Username = '$ruauser'";
$add_rua = mysql_query($ruasql);
}
//Heroic Value Is 2 - Heroic RUA Submitted
elseif ($ruavalue == 2) {
echo "nothing to do";
}
//Heroic Value Is 3 - Normal & Heroic RUA Submitted
elseif ($ruavalue == 3) {
echo "nothing to do";
}
}
}
我上面的当前代码根本不起作用我不确定我做错了什么但想法是当按下按钮时php检查它被点击然后执行基于$ ruavalue值的SQL字符串
答案 0 :(得分:1)