【发布时间】:2023-03-27 19:06:02
【问题描述】:
我为它们创建了一个登录和注册按钮分配链接,但它们在 Firefox 和 IE 中都不起作用,但在 Chrome 和 Safari 中却很好。代码放在 php 中的 echo 中,以便它们仅在用户未登录时显示。
<form>
<?php if(!$videosite->CheckLogin())
{
echo('<a href="Login.php">
<input name="submit" type="submit" class="g-button g-button-green" value="Sign in" width= 100% /></a>
<a href="register.php">
<input name="submit" type="submit" class="g-button g-button-red" value="Create an Account" width=100% /></a>');
}
else
{
?>
<a href="#"><input name="submit" type="submit" class="g-button g-button-submit" value=" <?php echo($videosite->UserFullName()); ?>" width=100% /></a>
<a href="logout.php"><input name="submit" type="submit" class="g-button g-button-white" value="Logout" width=100% /></a>;
<?php
}
?>
</form>
当用户根据他们按下的按钮点击进入登录或注册页面的按钮时,Chrome 和 Safari 会发生什么。在 Firefox 和 IE 的情况下,他们没有转到所需的页面,而是显示在 url- "http://localhost/project/?submit=Sign+in" 登录时!,注册时类似。
它有什么问题? 为什么它不能在 IE 和 Firefox 中运行?如何纠正?
【问题讨论】:
-
乍一看,您发布的代码不包含任何特定于浏览器的内容。看起来您隐藏了实际触发此问题的点,因此请先进行一些基本调试。
-
为什么你的
<submit>-s 周围需要包装器<a>-s? -
@hakre 是的,我知道没有什么是特定于浏览器的,但我仍然收到错误???
-
@ZoltanToth
<a>仅用于链接
标签: php internet-explorer firefox google-chrome