Jump to content

My Form Submit button isn't working


Stalingrad

Recommended Posts

Hey guys! I've looked through this code over and over today, and I still haven;t found where my error is. Here is my entire code:

 

<?php
session_start();
include("config536.php");
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<?php
if(!isset($_SESSION['username'])) {
echo "<banner></banner><nav>$shownavbar</nav><ubar><a href=login.php>Login</a> or <a href=register.php>Register</a></ubar><content><center><font size=6>Error!</font><br><br>You are not Logged In! Please <a href=login.php>Login</a> or <a href=register.php>Register</a> to Continue!</center></content>";
}

if(isset($_SESSION['username'])) {
echo "<nav>$shownavbar</nav><ubar>$ubear</ubar><content><center><font size=6>Quest Agency</font><br><br>";

$startjob = $_POST['submit'];
$jobq = "SELECT * FROM jobs WHERE username='$showusername'";
$job = mysql_query($jobq);
$jobnr = mysql_num_rows($job);

if($jobnr == "0") {
?>
<form action="<?php echo "$PHP_SELF"; ?>" method="POST">
<input type="submit" name="submit" value="Start Job"></form>
<?php
}
if(isset($startjob)) {
$initemidq = "SELECT * FROM items ORDER BY RAND() LIMIT 1";
$initemid = mysql_query($initemidq);
while($ir = mysql_fetch_array($initemid)) {
$ids = $ir['itemid'];
}
mysql_query("INSERT INTO jobs (username, item, time, completed) VALUES ('$showusername', '$ids', 'None', 'No')");
$wegq = "SELECT * FROM items WHERE itemid='$ids'";
$weg = mysql_query($wegq);
while($wg = mysql_fetch_array($weg)) {
$im = $wg['image'];
$nm = $wg['name'];
$id = $wg['itemid'];
}
$_SESSION['theid'] = $id;
$yeshere = $_SESSION['theid'];

echo "<font color=green>Success! You have started this Job!</font><br><br>Please bring me this item: <b>$nm</b><br><br><img src=/images/items/$im><br><br><br>";
}

if($jobnr == "1") {
$yeshere = $_SESSION['theid'];
$finish = $_POST['finish'];
$quit = $_POST['quit'];
$okgq = "SELECT * FROM items WHERE itemid='$yeshere'";
$ok = mysql_query($okgq);
while($ya = mysql_fetch_array($ok)) {
$okname = $ya['name'];
$okid = $ya['itemid'];
$okimage = $ya['image'];
}
$yeshere = $_SESSION['theid'];
echo "Where is my <b>$okname</b>?<br><br><img src=/images/items/$okimage><br><br><br>";
?>
<form action="<?php echo "$PHP_SELF"; ?>" method="POST">
<input type="submit" name="finish" value="I have the Item"><br><br>
<input type="submit" name="quit" value="Quit"></form>
<?php
}
}

if(isset($finish)) {
$yeshere = $_SESSION['theid'];
$cinq = "SELECT * FROM uitems WHERE theitemid='$_SESSION[theid]'";
$cin = mysql_query($cinq);
$connr = mysql_num_rows($cin);
if($connr != "0") {
mysql_query("DELETE FROM uitems WHERE username='$showusername' AND theitemid='$yeshere' LIMIT 1");
mysql_query("UPDATE users SET jobs=jobs+1 WHERE username='$showusername'");
mysql_query("UPDATE users SET credits=credits+320 WHERE username='$showusername'");
mysql_query("DELETE FROM jobs WHERE username='$showusername'");
echo "<font color=green>Success! You have completed this job! You have been given <b>320</b> credits as an award. Thank You!</font>";
} else {
echo "<font color=red>Error! You do not have my item!</font>";
}
if(isset($quit)) {
mysql_query("DELETE FROM jobs WHERE username='$showusername'");
echo "<font color=green>Success! You have quit this quest.</font>";
}
$yeshere = $_SESSION['theid'];

}
?>

 

The variable for the button is: $quit = $_post and I want the quit button to work. Does anybody know why it will not work? Thank you in advance!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.