<?php
//If statement to control pick selection "disabled/enabled"
if(strtotime("Today") == strtotime("Thursday") || strtotime("Friday") || strtotime("Saturday") || strtotime("Sunday") || strtotime("Monday")) {
echo '<h2>Make a selection! Picks are now available</h2>';
$pick = $_POST['teams'];
if(isset($_POST['teams'])) {
echo '<br><p>You have made a selection, feel free to change your pick until ONE HOUR before game time.<p><br>';
}
}
?>
<html>
<body>
<h3>Pick</h3>
<div class="loginForm">
<form action="test.php" method="POST">
<fieldset>
<legend>Pick</legend>
<select id="tm1" name="teams">
<option value="null"> Please Select Your Pick</option>
<option value="wr">Washington Redskins</option>
<option value="nyg">New York Giants</option>
<option value="pe">Philadelphia Eagles</option>
<option value="dc">Dallas Cowboys</option>
<option value="br">Baltimore Ravens</option>
<option value="ps">Pittsburgh Steelers</option>
<option value="tt">Tennessee Titans</option>
<option value="gbp">Green Bay Packers</option>
<option value="ss">Seattle Seahawks</option>
<option value="cbr">Cleveland Browns</option>
<option value="bb">Buffalo Bills</option>
<option value="jj">Jacksonville Jaguars</option>
<option value="ic">Indianapolis Colts</option>
<option value="ht">Houston Texans</option>
<option value="kcc">Kansas City Chiefs</option>
<option value="md">Miami Dolphins</option>
<option value="nep">New England Patriots</option>
<option value="nyj">New York Jets</option>
<option value="slr">Saint Louis Rams</option>
<option value="nos">New Orleans Saints</option>
<option value="mv">Minnesota Vikings</option>
<option value="tbb">Tampa Bay Buccaneers</option>
<option value="ac">Arizona Cardinals</option>
<option value="af">Atlanta Falcons</option>
<option value="sf49">San Francisco 49ers</option>
<option value="sdc">San Diego Chargers</option>
<option value="or">Oakland Raiders</option>
<option value="db">Denver Broncos</option>
<option value="cbe">Cincinnati Bengals</option>
<option value="cp">Carolina Panthers</option>
<option value="dl">Detroit Lions</option>
<option value="cbea">Chicago Bears</option>
</select>
<br>
<br>
<input type="submit" value="submit">
</fieldset>
</form>
</div>
到目前为止,我已经创建了一个下拉菜单和一个几乎完整的时间锁定系统。 我如何创建一个提交团队选择的每个人的计数器,并为每个用户显示一个团队,以查看谁选择了哪个团队?任何帮助将不胜感激!
答案 0 :(得分:0)
这绝不会起作用:
if(strtotime("Today") == strtotime("Thursday") || strtotime("Friday") || strtotime("Saturday") || strtotime("Sunday") || strtotime("Monday")) {
执行如下:
if (foo == (a || b || c || ...))
if (foo == (non-zero || non-zero || non-zero || ...)
if (foo == (true || true || true || ...)
if (foo == true)
它应该更像是
$days = array(strtotime(...), strtotime(...) , ...);
if (in_array(strtotime('today'), $days) { ... }