$this->db_handle = mysql_connect($this->server, $this->user_name, $this->password); $this->db_found = mysql_select_db($this->database, $this->db_handle); $this->sqa = "SELECT * FROM contact WHERE c_id='{$transfer}'"; $this->result = mysql_query($this->sqa); $this->resulta = mysql_fetch_assoc($this->result); return array($this->resulta['fname'], $this->resulta['lname'], $this->resulta['email'], $this->resulta['mobile'], $this->resulta['home'], $this->resulta['street'], $this->resulta['city']); mysql_close($this->db_handle); } } //End of contact class //creating object to run the [read contact()] method $new = new contacts('', '', '', '', '', '', ''); // collect new contact information from html and run class method if (isset($_POST['submit_contact'])) { $new = new contacts($_POST['fname'], $_POST['lname'], $_POST['email'], $_POST['mobile'], $_POST['home'], $_POST['street'], $_POST['city']); $new->add_contact(); header("Location: page_read.php"); } if (isset($_POST['update_contact'])) { $transfer = $_SESSION['transfer']; $new = new contacts($_POST['fname'], $_POST['lname'], $_POST['email'], $_POST['mobile'], $_POST['home'], $_POST['street'], $_POST['city']); $new->update_contact(); header("Location: page_read.php"); } // use contact id in session variable in the delete contact method if (isset($_POST['delete_contact'])) { $transfer = $_SESSION['transfer']; $new = new contacts('', '', '', '', '', '', ''); //$new = new contacts($_POST['fname'],$_POST['lname'],$_POST['email'],$_POST['mobile'],$_POST['home'],$_POST['street'],$_POST['city']); $new->delete_contact(); header("Location: page_read.php");