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

  • SEARCH
  • Home
  • 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 8782681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:37:43+00:00 2026-06-13T20:37:43+00:00

This may be an easy fix, but I can’t get my head around it

  • 0

This may be an easy fix, but I can’t get my head around it .

Basically I’ve remade my blog using a database and php rather than wordpress.
I want my site to show the most recent post first, then i’m using PhP postback to alter it

So far it works, but i can’t figure out a way for it to automatically go to the most recent one but then change after the postback.

 <?php 
$inId = $data[0];

//if (!empty($inId))
//{ 

//}
//else 
//{
//$inId = $_POST['ID'];
//} 
    include 'Includes.php';
    $blogPosts = GetBlogPosts($inId);  
    foreach ($blogPosts as $post)  
{  
    echo "<div class='post'>";
    echo "<h3>" . $post->title . "</h3>";
    echo "<p2>" . $post->post . "</p2>";  
    echo "<span class='footer'>Posted By: " . $post->Author . " Posted On: " . $post-       >datePosted . "</span>";  
}  
echo '<form name="myForm" action="Index.php" onsubmit="return validateFormStrings()"    method="post">';
echo'<select name ="ID">'; 

$query4 = "SELECT * FROM Blogs ORDER BY ID ";
$result = mysql_query($query4);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {    
          echo '<option value="'.$row['ID'].'">'.$row['Title'].'</option>';
          echo '<br>';               
    } 
    echo'</select>'; 
echo '<input type="submit" value="Retrieve Posts">';
echo '<a href="Index.Php" ></a>';

echo '</form>';
?>

As you see i tried to fiddle with !empty and things but that’s not really what im trying to do.
If i’m unclear let me know.

I almost need something like ” if ( button !pressed) then its data[0] else its the postback

Thanks in advance

  • 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-13T20:37:45+00:00Added an answer on June 13, 2026 at 8:37 pm

    I found out how to do it using the isset() function.

    if (isset($_POST['submit1'])) 
    {
    $inId = $_POST['ID'];
    }
     else
    { 
    $inId = $data[0];
    }
    

    This checks if the submit button has doe the postback or not. Works a treat.

    Gonna have a go at trying it with Ajax so I don’t need the button at all ^^

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

Sidebar

Related Questions

This may be an extremely easy question but I can't get my head around
This may be super easy to solve but I can't find the correct google
This may be super easy but I can't find any clear statement about it
This may be super easy, but I've read through the docs and can't find
I'm sure this is an easy fix but I can't seem to find it.
I fear this may be a dumb question/easy fix, but have been stuck for
I am fairly new to OSX development, so this may be easy but google
This may be an easy answer but I've been staring at it for too
This may seem an easy question, but not to me, also a search has
This may be a simple question but I can;t find the answer anywhere. Here

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.