Tjorriemorrie Posted July 17, 2008 Share Posted July 17, 2008 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 https://forums.phpfreaks.com/topic/115183-cant-get-record-updated/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.