Jump to content

Adding error messages when updating a form.


tarik321

Recommended Posts

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();
}
?>

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.