Exemplo n.º 1
0
<?php

session_start();
require_once '../file-includes.php';
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$info = array();
$info[] = fix_string($request->name);
$info[] = fix_string($request->address);
$info[] = fix_string($request->number);
$info[] = fix_string($request->email);
$info[] = fix_string($request->contactID);
$out_put = array();
$userID = get_userID_session();
edit_contact($info, $userID);
Exemplo n.º 2
0
 public static function handleEditContact($id)
 {
     //login user or display loginForm with errors
     $first_name = $_POST["first_name"];
     $last_name = $_POST["last_name"];
     $location = $_POST["location"];
     $email = $_POST["email"];
     $comments = $_POST["comments"];
     if (!edit_contact(array("first_name" => $first_name, "last_name" => $last_name, "location" => $location, "email" => $email, "comments" => $comments), $id)) {
         self::displayAddContactForm(array("error" => "Error inserting contact to list"));
     } else {
         //redirect to homepage on success
         header("Location: /contacts.php?action=list");
     }
 }