我有一个简单的脚本,假设如果我在 9:00 点出席,它将增加 8:30 小时(这是工作时间)+ 00:30(这是休息时间)。它会打印离开时间(6:00),但它不知道为什么:
<form id="form1" id="form1" action="mail.php" method="POST">
<label>time
<span class="small">Add your attendance time</span>
</label>
<input type="text" name="time" value="9:00" >
<label>Email
<span class="small">Enter a Valid Email</span>
</label>
<input type="text" name="email" value="amd@dt4it.com">
<br />
<br />
<label>break
<span class="small">break </span>
</label>
<select name="break" size="1">
<option value="00:30">yes</option>
<option value="00:00">no</option>
</select>
<br />
<br />
<br />
<button type="submit" value="Send" style="margin-top:15px;">Submit</button>
<div class="spacer"></div>
</form>
<?php
$time = $_POST['time'] + $_POST['break'] ;
$email = $_POST['email'];
$formcontent=" From: $time ";
$recipient = $email;
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
$time2 = strtotime($time)+ strtotime("08:30");
$result = date("H:i",strtotime($time2));
echo $result;
?>