kenwvs
08-11-2006, 09:37 AM
I have a form that appears to work the way it is suppose to until I hit the submit button on the form....then it won't update.
I have a form where you key in an ID number, which then takes you to another form with all of the information. You can add info to a couple of fields, which are the ones I want to update to the database, but they are not being updated.
If these fields don't have any info in them, should it be update, or should it be insert (or is insert only for new rows in a table)
I have had to comment out the following code, or the form was automatically giving me the successfully updated comment.
if (!isset($_POST['Submit'])){ I have also commented out the } at the other end of the code.
here is the update code I am using.
Purchase and Comment are both fields in the database, and are set to not null. These fields are not called to insert in the original form as they are not used at that point.
<BR><BR>
<div><input type="submit" name="Submit" value="Update Work Order"><BR><BR><BR><BR></div>
</form>
<?php
exit();
} else
{
$Work = $_POST["Work"];
$Sched = $_POST["Sched"];
$Name = $_POST["Tech"];
$Site = $_POST["Site"];
$Serial = $_POST["Serial"];
$Hours = $_POST["Hours"];
$Starts = $_POST["Starts"];
$Issue = $_POST["Issue"];
$Severity = $_POST["Severe"];
$Resolution = $_POST["Resolve"];
$Assistance = $_POST["Assist"];
$PartsA = $_POST["PartsA"];
$PartsB = $_POST["PartsB"];
$PartsC = $_POST["PartsC"];
$PartsD = $_POST["PartsD"];
$PartsE = $_POST["PartsE"];
$PartsF = $_POST["PartsF"];
$PartsG = $_POST["PartsG"];
$Safety = $_POST["Safe"];
$Image1 = $_FILE["Image1"];
$Image2 = $_FILE["Image2"];
$Image3 = $_FILE["Image3"];
$Image4 = $_FILE["Image4"];
$Purchase = $_POST["Purchase"];
$Comment = $_POST["Comment"];
$Remarks = $_POST["Remarks"];
mysql_query ("UPDATE `workorder` set Purchase = '$Purchase' , Comment = '$Comment' where
work = 'Work'")or die(mysql_error());
echo "This Work Order has been Updated Successfully";
//}
?>
I have a form where you key in an ID number, which then takes you to another form with all of the information. You can add info to a couple of fields, which are the ones I want to update to the database, but they are not being updated.
If these fields don't have any info in them, should it be update, or should it be insert (or is insert only for new rows in a table)
I have had to comment out the following code, or the form was automatically giving me the successfully updated comment.
if (!isset($_POST['Submit'])){ I have also commented out the } at the other end of the code.
here is the update code I am using.
Purchase and Comment are both fields in the database, and are set to not null. These fields are not called to insert in the original form as they are not used at that point.
<BR><BR>
<div><input type="submit" name="Submit" value="Update Work Order"><BR><BR><BR><BR></div>
</form>
<?php
exit();
} else
{
$Work = $_POST["Work"];
$Sched = $_POST["Sched"];
$Name = $_POST["Tech"];
$Site = $_POST["Site"];
$Serial = $_POST["Serial"];
$Hours = $_POST["Hours"];
$Starts = $_POST["Starts"];
$Issue = $_POST["Issue"];
$Severity = $_POST["Severe"];
$Resolution = $_POST["Resolve"];
$Assistance = $_POST["Assist"];
$PartsA = $_POST["PartsA"];
$PartsB = $_POST["PartsB"];
$PartsC = $_POST["PartsC"];
$PartsD = $_POST["PartsD"];
$PartsE = $_POST["PartsE"];
$PartsF = $_POST["PartsF"];
$PartsG = $_POST["PartsG"];
$Safety = $_POST["Safe"];
$Image1 = $_FILE["Image1"];
$Image2 = $_FILE["Image2"];
$Image3 = $_FILE["Image3"];
$Image4 = $_FILE["Image4"];
$Purchase = $_POST["Purchase"];
$Comment = $_POST["Comment"];
$Remarks = $_POST["Remarks"];
mysql_query ("UPDATE `workorder` set Purchase = '$Purchase' , Comment = '$Comment' where
work = 'Work'")or die(mysql_error());
echo "This Work Order has been Updated Successfully";
//}
?>