UPDATE with echoed PHP values not workin

admin

Administrator
Staff member
I am having SEVERE (!) problems getting the UPDATE to work from the following. I am trying to retrieve the data from the tables (thats fine) and it is echoed into the appropriate fields as can be seen in the HTML below. My problem is that when I Submit the revised field data from the page, it destroys ALL the data in the row on this table. NOT what I want. When I test the variables via echoing,, I get values for the search ID, but none for the fields themselves. Should this not return the field variables to mySQL?
I've been trying like anything to make this work. No dice. Please help!


<?php
include("dbconnect.php");
$sql="UPDATE rplc_com.Applicant SET CompName='$CompName', TradeName='$TradeName', Contact='$Contact', Title='$Title', Address='$Address', City='$City',Province='$Prov', PC='$PC', Phone='$Phone', Fax='$Fax', Email='$Email', YearsBusiness='$Years', IncDate='$IncDate', BusinessType='$BusType', Other='$OtherBusType', PremisesOwned='$Owned', Landlord='$Landlord', LandlordAddress='$LandlordAddress', LandlordTel='$LandlordTel', LandlordBusiness='$LandBusiness' WHERE AppID=$search";

if (mysql_query($sql)) {
echo ("<P> Your data has been added to the Database.</P>");
} else {
echo ("Error adding to the Database: ".mysql_error()."</P>");
}
?>

**************
Heres the HTML that is displayed for editing and submission back to the database...
***************
....
<td height="30" nowrap><div align="right"><form method="post" action="<?php echo $PHP_SELF?>"><input type="submit" name="update" value=http://www.phpbuilder.com/board/archive/index.php/"UPDATE"></div></form></td></tr>
</table></td></tr></table>
...
<td nowrap> <p><b>Company Name:</b></p></td>
<td> <p><input type="text" name="CompName" value="<?php echo $compname?>" size="24"></p></td>
<td width="20"> <p>&nbsp;</p></td>
<td> <p align="right"><b>Title:</b></p></td>
<td colspan="2"> <p><input type="text" name="Title" size="9" value="<?php echo $title?>"></p></td>
<td><p><b>Contact:</b></p></td>
<td><p><input type="text" name="Contact" size="20" value="<?php echo $contact?>"></p></td></tr></table>
 
Back
Top