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 8693297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:31:10+00:00 2026-06-13T00:31:10+00:00

Im building this blogg site and finally got everything considering uploading multiple pictures to

  • 0

Im building this blogg site and finally got everything considering uploading multiple pictures to one news article done.

Now my second step is to remove an article with following pictures to it.
Everything is set in the database so all i need is an ID from the news article.

When i press remove button on a article it shows the ID up in the URL… Im wondering how to get the specifik ID int from the URL and IF there is an smarter approach. It must be OOP and objectoriented apporach.

Code looks like this:

This is the looping out each article and notice $current_id that i put into a button to show in the url when its pressed

    public function doOutputArticles($newsList, $pictureList)
    {

        $result = '';
        foreach($newsList as $news)
        {
           $result .= '<ul>';   
           $current_id = $news->dbNewsID;
           $result .= '<li class="bloggNewsHeader">'.$news->dbHeader.'</li>';
           $result .= '<li class="bloggNews">'.$news->dbNews.'</li>';
           $result .= '<li class="bloggNewsDate">'.$news->dbNewsDate.'</li>';
           foreach($pictureList as $pic)
           {
              if($pic->dbNewsID == $current_id)
              {
                $result .= '<li class="bloggNewsPicID">'.$pic->dbPictureID.'</li>';
                $result .= '<img class="bloggNewsPic" src="./images/'.$pic->dbPicture.'"alt="some_text">';
              }  
           }
           $result .= "
                        <form id='' method='get'>
                            <input type='hidden'    name='$current_id'/>
                            <input type='submit'      name='removeArticle' value='Ta bort inlägg' />
                        </form>";

           $result .= '</ul>';
        }
        return "<div id='filesLoaded'>". $result ."</div>";

    }

`

After this is done, i press a button to remove specific article and then the ID shows in the URL, now this method is meant to GET the specific INT/NUMBER ID in the URL but HOW?

public function GetSelectedID()
    {       
        $ID = $_GET[self::$articleId];
        echo $ID;

        if(is_null($ID) || empty($ID))
        {
             return null;
        }
        else
        {
            echo $ID;
            return $ID;
        }

    }

`
Kind regards /Haris

  • 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-13T00:31:10+00:00Added an answer on June 13, 2026 at 12:31 am

    You don’t really need a form, a simple link would do and be clearer. You should be using a different endpoint for deletion rather than looking for “removeArticle”. This would be more OO since it would pave the path towards creating a specific Action Controller for each function rather than having one sprawling endpoint full of conditionals. Then you can have a consistent parameter (ideally within the URL path) of something like “articleId” that you are extracting from the URL. You’d also ideally want to redirect to the listing page upon completion to keep functionality focused in each method and also as a practice to avoid double posting issues (though this example is idempotent so it wouldn’t be overly important).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a site that has three main types of online news publications: Article
Right now I'm building a personal site/blog and have pretty much got it they
I'm building a site with CakePHP, but this question is more about solving an
I couldn't find any real sources for this. I'm building a site in ASP.NET
I'm building a blog that should parse bbcode tags like this: Input: <youtube=http://www.youtube.com/watch?v=VIDEO_ID&feature=channel> Output:
I'm building this application using PHP, MySQL and jQuery. Essentially it's a checklist management
i'm building this little function, what i need is this query to print me
I'm building this function but I'm not getting the desired output, it's been more
I'm building this small java applet in which I need a JPanel which will
I've been building this regex and it's getting complicated. ^(?=.{2,})[a-zA-Z0-9\s\-\,\.]+\*?$ Basically I validate names

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.