コード例 #1
0
    $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'];
    $new = new contacts('', '', '', '', '', '', '');
    $new->auto_fill();
    list($fname, $lname, $email, $mobile, $home, $street, $city) = $new->auto_fill();
    if ($mobile == 0) {
        $mobile = "";
    }
    if ($home == 0) {
        $home = "";