<?php

session_start();

if (!isset($_POST['submit'])) {
    exit('Fail!');
}
include "../../conf/conn.php";

$sql = "UPDATE `orders` SET 
`recipient name` = '" . mysqlSecurity($conn, $_POST["recipient_name"]) . "'
,`phone` = '" . mysqlSecurity($conn, $_POST["phone"]) . "' 
,`email` = '" . mysqlSecurity($conn, $_POST["email"]) . "' 
,`email` = '" . mysqlSecurity($conn, preg_replace("/\r\n/", '<br>', htmlspecialchars($_POST["remarks"]))) . "' 
,`address` = '" . mysqlSecurity($conn, preg_replace("/\r\n/", '<br>', htmlspecialchars($_POST["address"]))) . "'
WHERE `orders`.`record` = " . mysqlSecurity($conn, $_POST["record"]);

$_SESSION["page"] = 9;

echo "<script language='javascript' 
type='text/javascript'>";
echo "window.location.href='../e-shop.php';";

if ($query = mysqli_query($conn, $sql)) {
    echo 'alert("edit success.");</script>';
}