我这个代码为什么提交回复后点击退回键不能回到帖子列表页?
就是类似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(可擴展的標記語言)是一種用於人類可讀性和機器解析的多功能文本標記語言。它通常用於數據存儲
