PHP コードで奇妙なエラーが発生しましたが、その理由がわかりません!
エラー:Parse error: syntax error, unexpected '=' on line 9
<?php
session_start();
$name = $_POST['Contact-Name'];
$address = $_POST['Contact-address'];
$email = $_POST['Contact-Email'];
$phone = $_POST['Contact-Phone'];
$program = $_POST['Program-Name'];
$date-requested = $_POST['date-requested'];
$timestart = $_POST['program-start-time'];
$timeend = $_POST['program-end-time'];
$timestart-format = $_POST['starttime-format'];
$timeend-format = $_POST['endtime-format'];
$full-start-time = $timestart." ".$timestart-format;
$full-end-time = $timeend." ".$timeend-format;
//the book king hours
$mon-thurs-hours = array("10:00 AM", "11:00 AM", "12:00 PM", "1:00 PM", "2:00 PM", "3:00 PM", "4:00 PM", "5:00 PM", "6:00 PM");
$friday-hours = array("10:00 AM", "11:00 AM", "12:00 PM", "1:00 PM", "2:00 PM", "3:00 PM", "4:00 PM", "5:00 PM", "6:00 PM", "7:00 PM", "8:00 PM");
$saturday-hours = array("10:00 AM", "11:00 AM", "12:00 PM", "1:00 PM", "2:00 PM", "3:00 PM", "4:00 PM", "5:00 PM", "6:00 PM");
//find the day of the week and save to $dayofweek
$date = new DateTime();
$timestamp = date_timestamp_get($date-requested);
$dayofweek = date( "w", $timestamp);
//if sunday
if($dayofweek == 0){
echo "You choose Sunday!";
die('Sorry, the book king is closed on Sundays!');
}
//if monday, tues, wed, thurs
if(($dayofweek == 1)||($dayofweek == 2)||($dayofweek == 3)||($dayofweek == 4)){
echo "You choose day ".$dayofweek."!";
//see if bk is open at the specified times
if (in_array($full-start-time, $mon-thurs-hours)) {
echo "Start time is okay!";
}
if (in_array($full-end-time, $mon-thurs-hours)) {
echo "End time is okay!";
}
}
//if friday
if($dayofweek == 5){
echo "You choose day ".$dayofweek."!";
//see if bk is open at the specified times
if (in_array($full-start-time, $friday-hours)) {
echo "Start time is okay!";
}
if (in_array($full-end-time, $friday-hours)) {
echo "End time is okay!";
}
}
//if saturday
if($dayofweek == 6){
echo "You choose day ".$dayofweek."!";
//see if bk is open at the specified times
if (in_array($full-start-time, $saturday-hours)) {
echo "Start time is okay!";
}
if (in_array($full-end-time, $saturday-hours)) {
echo "End time is okay!";
}
}
?>
そのすべてのコードが必要なのか、それとも最初の 9 行だけが必要なのかはわかりませんが、念のためすべて投稿しました。
ご協力いただきありがとうございます。