我这个代码为什么提交回复后点击退回键不能回到帖子列表页?
就是类似SF的一个效果 我们在帖子列表页点击某一个标题进入到这个帖子主题里面 在主题里面提交发表完回复后再点一下浏览器的后退按钮就又退回到帖子列表页了 但我做的这个效果有个bug 就是如果不提交回复点一次就能回到帖子列表页 提交回复后需要点击两次退回按钮才能退回到帖子列表页 如果在这个帖子里面提交两次回复需要点击三次退回按钮才能回到帖子列表页 这是为什么啊?
这个就是帖子的主题页 tieba3.php
<code><meta http-equiv="Content-Type" content="text/html; charset=utf-8">; <title></title> <style type="text/css"> #top{position:relative;width: 1350px;height: 50px;border: 1px solid black;} #main{position: relative;margin: 0 auto;width: 900px;height: 600px;border: 1px solid black;} li{list-style: none;display: block;float: left;width: } #reply{position: absolute;bottom: 20px;width: 700px;height: 200px;border: 1px solid black;} </style> <div id="top"> <?php include "cookie.php"; ?> </div> <div id="main"> <div id="title"> <?php $pdo=new PDO("mysql:host=localhost;dbname=t1","root",""); $title=$_GET['id']; $stmt=$pdo->prepare("select id,title,content from topic where id=?"); $stmt->execute(array($title)); $res=$stmt->fetchall(PDO::FETCH_ASSOC); foreach($res as $v){ echo '<font size="5" face="arial">'.$v['content'].'</font>'; } ?> <?php $pdo=new PDO("mysql:host=localhost;dbname=t1","root",""); $id2=$_GET['id']; $stmt=$pdo->prepare("select id,reid,content from reply where reid=?"); $stmt->execute(array($id2)); $res1=$stmt->fetchall(PDO::FETCH_ASSOC); foreach($res1 as $v2){ echo $v2['content']; } ?> </div> <div id="reply"> <form method="POST" action="tieba4.php"> <input type="text" name="reid" value="<?php echo $_GET['id']; ?>"> <input type="text" name="name" value="<?php echo $_COOKIE['username'] ?>"> <textarea id="title" name="content"></textarea> <button type="submit">提交</button> </form> </div> </div> </code>
tieba4.php
<code><?php if(isset($_POST['reid'])){ $pdo=new PDO("mysql:host=localhost;dbname=t1","root",""); $stnt=$pdo->prepare("insert into reply(reid,name,content)values(:reid,:name,:content)"); $stnt->execute($_POST); header("location:http://localhost/tieba3.php?id=".$_POST['reid']); } ?></code>
回复内容:
就是类似SF的一个效果 我们在帖子列表页点击某一个标题进入到这个帖子主题里面 在主题里面提交发表完回复后再点一下浏览器的后退按钮就又退回到帖子列表页了 但我做的这个效果有个bug 就是如果不提交回复点一次就能回到帖子列表页 提交回复后需要点击两次退回按钮才能退回到帖子列表页 如果在这个帖子里面提交两次回复需要点击三次退回按钮才能回到帖子列表页 这是为什么啊?
这个就是帖子的主题页 tieba3.php
<code><meta http-equiv="Content-Type" content="text/html; charset=utf-8">; <title></title> <style type="text/css"> #top{position:relative;width: 1350px;height: 50px;border: 1px solid black;} #main{position: relative;margin: 0 auto;width: 900px;height: 600px;border: 1px solid black;} li{list-style: none;display: block;float: left;width: } #reply{position: absolute;bottom: 20px;width: 700px;height: 200px;border: 1px solid black;} </style> <div id="top"> <?php include "cookie.php"; ?> </div> <div id="main"> <div id="title"> <?php $pdo=new PDO("mysql:host=localhost;dbname=t1","root",""); $title=$_GET['id']; $stmt=$pdo->prepare("select id,title,content from topic where id=?"); $stmt->execute(array($title)); $res=$stmt->fetchall(PDO::FETCH_ASSOC); foreach($res as $v){ echo '<font size="5" face="arial">'.$v['content'].'</font>'; } ?> <?php $pdo=new PDO("mysql:host=localhost;dbname=t1","root",""); $id2=$_GET['id']; $stmt=$pdo->prepare("select id,reid,content from reply where reid=?"); $stmt->execute(array($id2)); $res1=$stmt->fetchall(PDO::FETCH_ASSOC); foreach($res1 as $v2){ echo $v2['content']; } ?> </div> <div id="reply"> <form method="POST" action="tieba4.php"> <input type="text" name="reid" value="<?php echo $_GET['id']; ?>"> <input type="text" name="name" value="<?php echo $_COOKIE['username'] ?>"> <textarea id="title" name="content"></textarea> <button type="submit">提交</button> </form> </div> </div> </code>
tieba4.php
<code><?php if(isset($_POST['reid'])){ $pdo=new PDO("mysql:host=localhost;dbname=t1","root",""); $stnt=$pdo->prepare("insert into reply(reid,name,content)values(:reid,:name,:content)"); $stnt->execute($_POST); header("location:http://localhost/tieba3.php?id=".$_POST['reid']); } ?></code>

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

PHP 8.4 带来了多项新功能、安全性改进和性能改进,同时弃用和删除了大量功能。 本指南介绍了如何在 Ubuntu、Debian 或其衍生版本上安装 PHP 8.4 或升级到 PHP 8.4

CakePHP 是 PHP 的开源框架。它的目的是使应用程序的开发、部署和维护变得更加容易。 CakePHP 基于类似 MVC 的架构,功能强大且易于掌握。模型、视图和控制器 gu

Visual Studio Code,也称为 VS Code,是一个免费的源代码编辑器 - 或集成开发环境 (IDE) - 可用于所有主要操作系统。 VS Code 拥有针对多种编程语言的大量扩展,可以轻松编写

CakePHP 是一个开源MVC 框架。它使开发、部署和维护应用程序变得更加容易。 CakePHP 有许多库可以减少大多数常见任务的过载。

本教程演示了如何使用PHP有效地处理XML文档。 XML(可扩展的标记语言)是一种用于人类可读性和机器解析的多功能文本标记语言。它通常用于数据存储
