<?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>
<br>
</body>
<html>
这就是我到目前为止,我在使用isset()内部的if语句中隐藏第二个echo语句时遇到了麻烦,直到选择了。这一点的主要意义在于我可以使用提交“POST”功能的html“选择”下拉列表表单,该功能可以根据一周中的几天锁定,星期一晚上锁定到星期四早上解锁。任何帮助将不胜感激。
答案 0 :(得分:0)
在HTML代码
之后尝试使用检查'pick'的php脚本<?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>';
}
?>
<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>
<br>
<?php
if(isset($_POST['teams'])) {
$pick = $_POST['teams'];
echo '<br><p>You have made a selection, feel free to change your pick until ONE HOUR before game time.<p><br>';
}
?>
</body>
<html>