Jump to content

Can't get record updated


Tjorriemorrie

Recommended Posts

Hey, if anyone can please check my code for me. I want to update a record, i select the entry from the list, but when i click the button, no post values exist. No errors, and it's not updated.

 

Here's the code to update (at top of file):

It updates the one record setting one field as the id of another field (as the followup or required) and does the reverse for the other record involved.

// ========== UPDATE RECORD ==========
if ($_POST['Submit'] == 'Set required' || $_POST['Submit'] == 'Set followup') {

  // Get parameters from form
  $id = $questID;
  $questToSetID = $_POST['questToSet'];

  // Do update statement
  if ($_POST['Submit'] == 'Set required') {
    $query = "UPDATE quests SET ReqQst='$questToSet' WHERE QID='$id'";
print($query);
$queryVV = "UPDATE quests SET FolQst='$id' WHERE QID='$questToSet'";
print($queryVV);
  } elseif ($_POST['Submit'] == 'Set followup') {
    $query = "UPDATE quests SET FolQst='$questToSet' WHERE QID=$id";
print($query);
$queryVV = "UPDATE quests SET ReqQst='$id' WHERE QID='$questToSet'";
print($queryVV);
  } else {
    unset($query);
unset($queryVV);
  }
  
  Connect();
  
  // Do update
  if (mysql_query($query)) {
    if (mysql_query($queryVV)) {
      $updateGoTo = 'RecSeries.php?qst=' . $questID;
      header("Location: $updateGoTo");
} else {echo '<h1>ERROR updating vica versa quest!</h1>'; exit;}
  } else {echo '<h1>ERROR updating quest!</h1>' . var_dump($_POST); exit;}
}
// ========== END update record ==========

 

Here is one of the lists to select: the values appears fine, but it's like no post values are submitted. I have put a print_r($_Post) on top file and when this submit button is pushed, the post array is empty, but the method="post", so i'm clueless as to why nothing gets posted.

 

	$questsInZone = GetQuestsInZone($zone);
//$questsInZone = array("null" => "<none>") + $questsInZone;
    

    // 3A - REQUIRED //
    if ($setValue == 'req') { ?>
    <form id="form" name="form" method="post" action="RecSeries.php?qst=<?php echo $questID; ?>">
      <p><span id="spryselect5">
        <label for="questToSet">Required quest:</label>
        <select name="questToSet" id="questToSet2"><?php
          foreach ($questsInZone as $reqQuestID => $reqQuestName) {
        $reqQuest = GetQuestInfo($reqQuestID);
        if (empty($reqQuest['FolQst']) && $reqQuest['Faction'] == $quest['Faction'] && $reqQuestID != $questID) { ?>
          <option value="<?php echo $reqQuestID; ?>"><?php echo $reqQuestName; ?></option><?php
        }
	  } ?>
        </select>
        <span class="selectRequiredMsg">Please select an item.</span></span></p>
      <p><input type="submit" name="Submit" id="Submit" value="Set required" />
      </p>
    </form>

 

I think the problem is nothing gets posted when I click the Set required button. Any help appreciated!

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.