コード例 #1
0
        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");
}
//acquire contact id from the get method and insert into a session variable  to be used for the auto fill method
if (isset($_GET['transfer'])) {
    $_SESSION['transfer'] = $_GET['transfer'];
    $transfer = $_SESSION['transfer'];
    echo $_SESSION['transfer'];