diff --git a/cart.php b/cart.php index 0d2a284..0960ab6 100644 --- a/cart.php +++ b/cart.php @@ -71,4 +71,8 @@ +
+ diff --git a/shipping.php b/shipping.php new file mode 100644 index 0000000..36272c0 --- /dev/null +++ b/shipping.php @@ -0,0 +1,94 @@ + null !== $_POST['name'] ? htmlspecialchars($_POST['name']) : '', + 'zip' => null !== $_POST['zip'] ? htmlspecialchars($_POST['zip']) : '', + 'prefecture' => null !== $_POST['prefecture'] ? htmlspecialchars($_POST['prefecture']) : '', + 'city' => null !== $_POST['city'] ? htmlspecialchars($_POST['city']) : '', + 'address1' => null !== $_POST['address1'] ? htmlspecialchars($_POST['address1']) : '', + 'address2' => null !== $_POST['address2'] ? htmlspecialchars($_POST['address2']) : '', + 'country' => null !== $_POST['country'] ? htmlspecialchars($_POST['country']) : '', + 'email' => null !== $_POST['email'] ? htmlspecialchars($_POST['email']) : '', + ]; + + if (isset($_POST['topayment'])) { + if (!isset($_POST['name']) || $_POST['name'] == '') $errcheck['name'] = $eigo ? 'Name' : 'お名前'; + if (!isset($_POST['zip']) || $_POST['zip'] == '') $errcheck['zip'] = $eigo ? 'ZIP Code' : '郵便番号'; + if (!isset($_POST['prefecture']) || $_POST['prefecture'] == '') $errcheck['prefecture'] = $eigo ? 'State/Province/Prefecture' : '都道府県'; + if (!isset($_POST['city']) || $_POST['city'] == '') $errcheck['city'] = $eigo ? 'City/Town' : '市区町村'; + if (!isset($_POST['address1']) || $_POST['address1'] == '') $errcheck['address1'] = $eigo ? 'Address 1' : '町名+番地'; + if (!isset($_POST['country']) || $_POST['country'] == '') $errcheck['country'] = $eigo ? 'Country' : '国'; + if (!isset($_POST['email']) || $_POST['email'] == '' || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) $errcheck['email'] = $eigo ? 'Email' : 'メール'; + unset($_POST['topayment']); + + if (count($errcheck) > 0) { + $err = $eigo ? 'Please check the following fields:' : '下記のフィールドをご確認下さい:'; + echo $err .= '