Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8139993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:00:54+00:00 2026-06-06T12:00:54+00:00

I have a relatively simple class which deletes a post: function delete_post($postid, $reason){ //Stuff

  • 0

I have a relatively simple class which deletes a post:

function delete_post($postid, $reason){

    //Stuff to delete post      
    $this->delete_response = 'Thanks, your course has been removed.';

}

This function is called at the top of a page with a form on. If the form is submitted, the same page checks the POST[] and carries out the function, like so:

if(!empty($_POST['removecourse'])){
    $courseManager->delete_post($_POST['courseid'], $_POST['cancel-reason']);
    echo $courseManager->delete_response;
}; 

So my problem is… when I refresh the page, the message keeps displaying. I know this is because I am re-submitting the form, and because there is no such P/R/G pattern going on, but as i am new to OOP, im wondering if im doing this the right way, or if anyone could suggest a way similar to PRG or something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:00:56+00:00Added an answer on June 6, 2026 at 12:00 pm

    Add an if that test if somthing changed, like mysql_affected_rows

    function delete_post($postid, $reason)
    {
        //Stuff to delete post
        if(mysql_affected_rows())
        {
           $this->delete_response = 'Thanks, your course has been removed.';
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a relatively simple class. I serialize it using JDK 1.7 on my
I have a relatively simple application which I need to make native Mac OSX
I have this relatively simple regex for usernames // Enforce that username has to
A relatively simple question. I have a datagridview, which all it does is displays
I have a set of classes and interfaces which have a relatively simple hierarchy,
Say I have a simple class AClass with a public member f1 which can
I have a relatively simple query joining two tables. The Where criteria can be
I have a relatively simple question that I cannot seem to find the answer
I have a relatively simple subset of tables in my database for tracking something
I have a relatively simple algorithm that walks an std::vector looking for two neighbouring

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.