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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.