Php 从URL获取日期/时间格式
我正在尝试使用$\u get从URL获取日期/时间格式,并将其放入一个输入字段: 这是格式:09/11/2019 14:48 CDT 09/11/2019 14:48 CDTPhp 从URL获取日期/时间格式,php,urlencode,urldecode,Php,Urlencode,Urldecode,我正在尝试使用$\u get从URL获取日期/时间格式,并将其放入一个输入字段: 这是格式:09/11/2019 14:48 CDT 09/11/2019 14:48 CDT $stime = "09/11/2019 14:48 CDT 09/11/2019 14:48 CDT"; $etime = ""; 提交表格时,这是代码的一部分: 包括/connect.inc.php if (empty($stime) || empty($etime)) { heade
$stime = "09/11/2019 14:48 CDT 09/11/2019 14:48 CDT";
$etime = "";
提交表格时,这是代码的一部分:
包括/connect.inc.php
if (empty($stime) || empty($etime)) {
header("Location: ../home.php?error=emptyfields&stime=".rawurlencode($stime)."");
exit();
}
if (isset($_GET['error'])) {
$stime = ($_GET['stime']);
}else {
$stime = "";
}
<form method="post" action="includes/connect.inc.php" enctype="multipart/form-data">
<li>Start Time : <input type="text" name="stime" id="dato8" value=<?php echo rawurldecode($stime); ?> ></li>
<input type="submit" value="Submit" class="button">
</form>
这是表单/输入字段所在的代码:
home.php
if (empty($stime) || empty($etime)) {
header("Location: ../home.php?error=emptyfields&stime=".rawurlencode($stime)."");
exit();
}
if (isset($_GET['error'])) {
$stime = ($_GET['stime']);
}else {
$stime = "";
}
<form method="post" action="includes/connect.inc.php" enctype="multipart/form-data">
<li>Start Time : <input type="text" name="stime" id="dato8" value=<?php echo rawurldecode($stime); ?> ></li>
<input type="submit" value="Submit" class="button">
</form>
提前谢谢
迭戈我忘了添加双引号,代码应该是这样的:
<li>Start Time : <input type="text" name="stime" id="dato8" value="<?php echo rawurldecode($stime); ?>"></li>
开始时间:includes/connect.inc.php中的if条件应该颠倒:if(empty($stime)| empty($etime)){
应该是if(!empty($stime)| empty($etime)){
“知道我做错了什么吗?”-你忘了将属性值正确地用引号括起来…你好@04FS谢谢你的时间,你能说得更具体些吗?@04FS哦,我知道了,你是对的,我忘了这么做,请写下你的评论作为回答,谢谢你的时间和帮助,祝你过得愉快。