当按下开始按钮时,我使用以下代码在文本字段中显示当前系统时间。此代码在 FireFox 和 Chrome 中运行良好,但 IE 8 在按下开始按钮时不显示时间和日期。如果我点击提交按钮,它就会起作用。
请告诉我我在这里做错了什么:
<form name="form1" action='' method='post'>
<table>
<tr>
<th>
<p>Vendor was contacted at:</p>
<button name="time" >Start</button><br>
<?php
if (isset($_POST['start']))
{
$date_start = date('m-d-Y H:i:s');;
$_SESSION['start'] = $date_start;
}
?>
<br>
<input name="start" type="text" class="textfield" value="<?php echo $_SESSION['start']; ?>"
<br>
</th>
</tr>
<tr>
<th>
<br><input type='submit' name='submit' value='Submit'><br>
</th>
</tr>
</table>
</form>
最佳答案
您的 HTML 无效。你忘记了>
在您的<input
上
<input name="start" type="text" class="textfield" value="<?php echo $_SESSION['start']; ?>">
关于php - IE8 不显示 php echo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32528607/