【发布时间】:2014-11-11 18:52:57
【问题描述】:
您好,我正在尝试为我的网站http://social.nssgaming.com/ 制作注册表单,但注册表中有错误。我不知道出了什么问题。我不会用 3 个盒子来设置日期、月份和年份。 register.php 位于此处:http://paste2.org/a31FJE5L 您可以在此处的索引文件中设置生日部分:(这也是说它在表单中缺少一些值,我认为它在生日注册中)
<?php
function GetMonthString($n){
$timestamp = mktime(0, 0, 0, $n, 1, 2010);
return date("F", $timestamp);
}
$display .= '</select>
<select name="year" class="birthday_btn" id="year">
<option value="">- Year -</option>';
$thisyear = date('Y');
$now = $thisyear - 1;
$end = $thisyear - 100 ;
for ($now; $now >= $end; $now--) {
if ($_POST['year'] == $now){
$display .= '<option value="'.$now.'" selected>'.$now.'</option>';
}
else{
$display .= '<option value="'.$now.'" >'.$now.'</option>';
}
}
$display .= '</select> ';
$display .='</select>
<select name="month" class="birthday_btn" id="month">
<option value="" >- Month -</option>';
for ($i = 1; $i <= 12; $i++) {
if ($_POST['month'] == $i){
$display .= '<option value="'.$i.'" selected>'.GetMonthString($i).'</option>';
}
else{
$display .= '<option value="'.$i.'" >'.GetMonthString($i).'</option>';
}
}
$display .= '</select>
<select name="day" class="birthday_btn" id="day">
<option value="'.$i.'" >- Day -</option>';
for ($i = 1; $i <= 31; $i++) {
if ($_POST['day'] == $i){
$display .= '<option value="'.$i.'" selected>'.$i.'</option>';
}
else{
$display .= '<option value="'.$i.'" >'.$i.'</option>';
}
}
$display .= '</select> ';
echo $display;
?>
在本地主机中我得到了这些错误:
生日
注意:未定义变量:显示在 C:\xampp\htdocs\social\index.php 的第 237 行
注意:未定义索引:C:\xampp\htdocs\social\index.php 第 244 行中的年份
注意:未定义索引:C:\xampp\htdocs\social\index.php 第 257 行中的月份
注意:未定义索引:C:\xampp\htdocs\social\index.php 第 271 行中的日期
【问题讨论】:
-
@seane 关于假定重复链接的问题没有解决
标签: php