Update Colors
Business Contact Person:
Color:
'; } // close while loop brace } // close else brace } //close if no action brace // if action = update, check fields, and update the db. if($_GET['action']=="update"){ // check for errors $err = false; // currently, there is no errors. $errmsg = 'Error
'; // empty error msg. msg with no current errors. // check to see if title field is empty or not. if so, make error. if(empty($_POST['artist'])){ $err = true; // there is now an error. $errmsg .= 'artist is a required field and must be filled out.
'; // append an error msg to the end of $errmsg } // check to see if content field is empty or not. if so, make error. if(empty($_POST['track'])){ $err = true; // there is now an error. $errmsg .= 'track 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. $artist = $_POST['artist']; $track = $_POST['track']; //connect to the mysql server //insert the new info into the database $query = "update bridal_songs set artist='".$artist."'"; $result = mysql_query($query) or die(mysql_error()); $query = "update bridal_songs set track='".$track."'"; $result = mysql_query($query) or die(mysql_error()); echo ' return '; } } // close if action = update brace ?>