tarik321 Posted March 11, 2008 Share Posted March 11, 2008 Hi i was wondering if anyone has an answer to my proble, i have been up all night trying ti figure it out. Basically a user would fill in an blank form (contains error messages if they have missed out an field) and then submit it to be saved to the database. But if the user then wanted to update the information, they can do, but if a field is left blank when doing this the error messaging does not work, and im not sure why. This is the form checking code. - The ID of the form is called FormID Any help would be appreciated Thanks <?php require "connect.php"; $formID = $_GET['formID']; $issuetitle = $_GET['issuetitle']; $datesubmitted = $_GET['datesubmitted']; $timesubmitted = $_GET['timesubmitted']; $systemaffected = $_GET['systemaffected']; $prioritylevel = $_GET['prioritylevel']; $issuedetails = $_GET['issuedetails']; $supportcomments = $_GET['supportcomments']; $clientFname = $_GET['clientFname']; $clientSurname = $_GET['clientSurname']; $teamname = $_GET['teamname']; $clientID = $_GET['clientID']; $status = $_GET['status']; $dateactioned = $_GET['dateactioned']; $timeactioned = $_GET['timeactioned']; $analystFname = $_GET['analystFname']; $analystSname = $_GET['analystSname']; if($prioritylevel == "Please Select") { $message1 = "Please select the issue topic"; header("Location: analystformedit.php?message1=$message1"); exit(); } else if($status == "Please Select") { $message2 = "Please enter the system affected"; header("Location: analystformedit.php?message2=$message2"); exit(); } else if($supportcomments == "") { $message3 = "Please enter details of the problem"; header("Location: analystformedit.php?message3=$message3"); exit(); } $query = "update form set issuetitle ='".$issuetitle."', datesubmitted ='".$datesubmitted."', timesubmitted ='".$timesubmitted."', systemaffected ='". $systemaffected."', prioritylevel ='".$prioritylevel."', issuedetails ='".$issuedetails."', supportcomments ='".$supportcomments."', clientFname ='".$clientFname."', clientSurname ='".$clientSurname."', teamname ='".$teamname."', clientID ='".$clientID."', status ='".$status."', dateactioned = '".$dateactioned."', timeactioned = '". $timeactioned."', analystFname = '".$analystFname."', analystSname = '".$analystSname."' where formID =".$formID; $result = mysql_query($query, $connection) or die ("Unable to perform query<br>$query"); header("Location: enquiryscreen.php?var=formID"); exit(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/95628-adding-error-messages-when-updating-a-form/ Share on other sites More sharing options...
MadTechie Posted March 11, 2008 Share Posted March 11, 2008 update them to check if they are empty ie if($prioritylevel == "Please Select" || empty($prioritylevel)) Quote Link to comment https://forums.phpfreaks.com/topic/95628-adding-error-messages-when-updating-a-form/#findComment-489642 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.