After posting a reply in the post, click "back" and you will not be able to return to the Post list page. why?

Source: Internet
Author: User
After posting a reply in the post, click "back" and you will not be able to return to the Post list page. why? The effect of my post can be directly returned to the Post list page when I click return on the post content page. However, if I click return after submitting the reply content but cannot return to the Post list page, I need to click it again to go back. to submit two replies, you must return three times to go back to the Post list page. the more replies you submit, the more replies you need to return. what is the problem?


Reply to discussion (solution)

I don't see the code.

I don't see the code.


Is that the code that I have been asking a few days ago?

If you use a form, after submission, it is equivalent to entering a new page. if you click it once, it is still the original page.
Changing to ajax asynchronous submission can achieve the desired effect.

So many posts, which knows who is right?

So many posts, which knows who is right?


This is the code below. this is the Post homepage. after the content is submitted on this page, the Post list page cannot be clicked once.

Tieba3.php
;








Include "cookie. 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 ''. $ v ['content'].'';
}
?>
$ 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'];
}
?>









Tieba4.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 ']);
}
?>

Header ("location: http: // localhost/tieba3.php? Id = ". $ _ POST ['Reid ']);
Tieba3.php is obviously a content page rather than a list page.

Header ("location: http: // localhost/tieba3.php? Id = ". $ _ POST ['Reid ']);
Tieba3.php is obviously a content page rather than a list page.



Yes, this is just a page inserted into the database. after the page is submitted and displayed, it is such a page. for example, if I want to return to the Post list page after posting a reply, click the back button. the Post list page cannot be returned.

You just need to change tieba3.php to the program file on the list page?

You just need to change tieba3.php to the program file on the list page?


That's how it works.

If you use a form, after submission, it is equivalent to entering a new page. if you click it once, it is still the original page.
Changing to ajax asynchronous submission can achieve the desired effect.



I don't know about asynchronous submission, so I don't know how it is implemented, or whether it is the result I want.

The person on the third floor has already replied to you. if you click on the browser's return, of course, it will be returned to the last page-the page before you submit the request. If you click a self-written return button, the jump link of the return button is incorrect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.