0)) { # id to edit $editid = $_REQUEST['id']; # grab info $query = "SELECT company_name,contact_name,address,city,state,zipcode,phone,email,url,catid FROM vendors WHERE id='".mysql_real_escape_string($editid)."'"; $result = mysql_query($query); if((!$result) || (@mysql_num_rows($result) < 1)) { die('That ID does no exist'); } else { $row = mysql_fetch_object($result); ?>

Vendor Details

Add Vendor
Company Name:Contact name:
Address:City:
State:Zipcode:
Phone:Email:
URL:Select a category:
Category
0)){ # id to edit $editid = $_REQUEST['id']; // check for errors $err = false; // currently, there is no errors. $errmsg = 'Error
'; // empty error msg. msg with no current errors. // check to see if content field is empty or not. if so, make error. if(empty($_POST['contact_name'])){ $err = true; // there is now an error. $errmsg .= 'Content is a required field and must be filled out.
'; // append an error msg to the end of $errmsg } // if there's an error ( $err = true ), let them know and exit. if($err) { echo $errmsg; exit; } if(!$err){ // if no errors, do the foloowing // store the fields into an easier writeable variable. so you dont have to type $_POST[''] to use it everytime. $contact_name = $_POST['contact_name']; $company_name = $_POST['business_name']; //connect to the mysql server //insert the new info into the database $query = "update contact set contact_name='". $contact_name ."', business_name='". $business_name ."' where id = '".mysql_real_escape_string($editid)."'"; $result = mysql_query($query) or die(mysql_error()); echo ' return '; } } // close if action = update brace ?>