在 IE 中,此代码显示顶部 div 内的表单,它应该:
<div style = 'height:100px;background-color:#FF6600'>
<form name = "search" action = "search_result.php" method = "get" style = "text-align:right;">
<input type = "text" name = "query" id = "query" maxlength = "100">
<br />
<input type = "radio" value = "Search users" name = "user" id = "user"> <input type = "radio" value = "Search topics" name = "topics" id = "topics">
<input type = "Submit" value = "Go">
</form>
</div>
但在 Chrome 中,它会在 div 下方显示表单。为什么会这样,我该如何解决?
echos
编辑:我省略了一些HTML 的一些 PHP 代码。这是我的完整代码:
<!DOCTYPE html>
<html>
<body>
<?php
session_start();
$connect = mysql_connect('localhost','phpuser','mypss');
$db = mysql_select_db('phpuser');
echo "<div style = 'float:none;clear:both;height:100px;background-color:#FF6600'>";
if(isset($_SESSION['user'])&&$_SESSION['user']!="")
{
echo "<a href = 'userinfo.php'>".$_SESSION['user']."</a>";
echo " ";
echo "| ";
echo "<a href = 'logout.php'>Log out</a> ";
echo "| ";
}
echo "<a href = 'home.php'>Home</a>";
if(!isset($_SESSION['user'])||$_SESSION['user']=="")
{
echo " | ";
echo "<a href = 'login.php'>Log in</a> | ";
echo "<a href = 'signup.php'>Sign up</a> ";
}
function trimtext($text)
{
$newtext = substr($text,0,15);
$newtext .= "...";
return $newtext;
}
?>
<h1 style = "color:black">My blog</h1>
<form name = "search" action = "search_result.php" method = "get" style = "text-align:right;">
<input type = "text" name = "query" id = "query" maxlength = "100">
<br />
<input type = "radio" value = "Search users" name = "user" id = "user"> <input type = "radio" value = "Search topics" name = "topics" id = "topics">
<input type = "Submit" value = "Go">
</form>
</div>
</body>
</html>