织梦DEDE自定义表单在后台显示时间的方法仿站必
DEDE的自定义表单功能,可以用来实现网站留言,下面就是制作的方法,并且还能够在后台显示访客提交数据的时间,很直观。
<form action="/plus/diy.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="diyid" value="1" />
<input type="hidden" name="do" value="2" />
<table style="width:97%;" cellpadding="0" cellspacing="1">
<tbody><tr>
<td align="right" valign="top">用户角色:</td>
<td><input type="radio" name='xuesheng' class='np' value='家长' checked>家长
<input type="radio" name='xuesheng' class='np' value='学生'>学生
</td>
</tr>
<tr>
<td align="right" valign="top">用户姓名:</td>
<td><input required type="text" name='name' id='name' style="width:250px" class="intxt aiaedu_name" value=""> <span class="whitecolor">*</span>
</td>
</tr>
<tr>
<td align="right" valign="top">用户性别:</td>
<td><input type="radio" name='sex' class='np' value='男' checked>男
<input type="radio" name='sex' class='np' value='女'>女
</td>
</tr>
<tr>
<td align="right" valign="top">出生日期:</td>
<td><input type="text" name='time' id='time' style="width:250px" class="intxt" value="">
</td>
</tr>
<tr>
<td align="right" valign="top">邮寄地址:</td>
<td><input type="text" name='youbian' id='youbian' style="width:250px" class="intxt" value="">
</td>
</tr>
<tr>
<td align="right" valign="top">常用邮箱:</td>
<td><input type="email" name='email' id='email' style="width:250px" class="intxt" value="">
</td>
</tr>
<tr>
<td align="right" valign="top">手机号码:</td>
<td><input required type="text" name='telphone' id='telphone' style="width:250px" class="intxt aiaedu_phone" value=""> <span class="whitecolor">*</span>
</td>
</tr>
<tr>
<td align="right" valign="top">就读高中:</td>
<td><input type="text" name='school' id='school' style="width:250px" class="intxt aiaedu_school" value=""> <span class="whitecolor">*</span>
</td>
</tr>
<tr>
<td align="right" valign="top">备注内容:</td>
<td><textarea name='pscontent' id='pscontent' class="beizhu"></textarea>
</td>
<tr style="display:none;">
<td align="right" valign="top">提交时间:</td>
<td><input type="hidden" name='mytime' id='mytime' style="width:250px" class="intxt ft_time" value=""> //type=hidden就是不要其在前端显示,但是后台可以看到。下面的js代码就是为了后台显示时间的。
<script type="text/javascript">
window.onload = function(){
var nowDate = new Date();
var str = nowDate.getFullYear()+"-"+(nowDate.getMonth() + 1)
+"-"+nowDate.getDate()+" "+nowDate.getHours()+":"+nowDate.getMinutes()
+":"+nowDate.getSeconds();
document.getElementById("mytime").value=str;
}
</script>
</td>
</tr>
</tr>
<input type="hidden" name="dede_fields" value="name,text;sex,radio;xuesheng,radio;tim
<form action="/plus/diy.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="diyid" value="1" />
<input type="hidden" name="do" value="2" />
<table style="width:97%;" cellpadding="0" cellspacing="1">
<tbody><tr>
<td align="right" valign="top">用户角色:</td>
<td><input type="radio" name='xuesheng' class='np' value='家长' checked>家长
<input type="radio" name='xuesheng' class='np' value='学生'>学生
</td>
</tr>
<tr>
<td align="right" valign="top">用户姓名:</td>
<td><input required type="text" name='name' id='name' style="width:250px" class="intxt aiaedu_name" value=""> <span class="whitecolor">*</span>
</td>
</tr>
<tr>
<td align="right" valign="top">用户性别:</td>
<td><input type="radio" name='sex' class='np' value='男' checked>男
<input type="radio" name='sex' class='np' value='女'>女
</td>
</tr>
<tr>
<td align="right" valign="top">出生日期:</td>
<td><input type="text" name='time' id='time' style="width:250px" class="intxt" value="">
</td>
</tr>
<tr>
<td align="right" valign="top">邮寄地址:</td>
<td><input type="text" name='youbian' id='youbian' style="width:250px" class="intxt" value="">
</td>
</tr>
<tr>
<td align="right" valign="top">常用邮箱:</td>
<td><input type="email" name='email' id='email' style="width:250px" class="intxt" value="">
</td>
</tr>
<tr>
<td align="right" valign="top">手机号码:</td>
<td><input required type="text" name='telphone' id='telphone' style="width:250px" class="intxt aiaedu_phone" value=""> <span class="whitecolor">*</span>
</td>
</tr>
<tr>
<td align="right" valign="top">就读高中:</td>
<td><input type="text" name='school' id='school' style="width:250px" class="intxt aiaedu_school" value=""> <span class="whitecolor">*</span>
</td>
</tr>
<tr>
<td align="right" valign="top">备注内容:</td>
<td><textarea name='pscontent' id='pscontent' class="beizhu"></textarea>
</td>
<tr style="display:none;">
<td align="right" valign="top">提交时间:</td>
<td><input type="hidden" name='mytime' id='mytime' style="width:250px" class="intxt ft_time" value=""> //type=hidden就是不要其在前端显示,但是后台可以看到。下面的js代码就是为了后台显示时间的。
<script type="text/javascript">
window.onload = function(){
var nowDate = new Date();
var str = nowDate.getFullYear()+"-"+(nowDate.getMonth() + 1)
+"-"+nowDate.getDate()+" "+nowDate.getHours()+":"+nowDate.getMinutes()
+":"+nowDate.getSeconds();
document.getElementById("mytime").value=str;
}
</script>
</td>
</tr>
</tr>
<input type="hidden" name="dede_fields" value="name,text;sex,radio;xuesheng,radio;tim
上一篇:DEDECMS织梦重命名更改plus文件夹名称的简单方法 下一篇:DEDE自定义表单显示提交时间|添加提交时间,获取