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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:08:19+00:00 2026-05-23T17:08:19+00:00

2 PHP related questions here I think: 1) Is it possible to use PHP

  • 0

2 PHP related questions here I think:

1) Is it possible to use PHP to display a line of text between certain times, so for example, I might want to display “Good Morning” between 5am and 12pm PST, “Good Afternoon” between 12:01pm and 4:59pm PST, “Good Evening” between “5:00pm and 9:00pm” and “Good Night” from 9:00pm until 4:59am PST.

If this is possible, what would the PHP look like?

2) I have a simple HTML form that posts its result into a database table. Is it possible to add a hidden field somewhere that notes the DATE and TIME the data entry was added to the database? If so, what would I add to my form and database?

  • 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-05-23T17:08:20+00:00Added an answer on May 23, 2026 at 5:08 pm

    You can just use an if-else statement to display certain text.

    $current_hour = intval(date('H'));
    
    if ( $current_hour < 12 )
    {
        echo "Good Morning";
    }
    else if ( $current_hour < 17 )
    {
        echo "Good Afternoon";
    }
    else
    {
        echo "Good evening";
    }
    

    As for the HTML form, you’d be better off not having a hidden field, rather including the date from the page that processes the SQL statement.

    http://php.net/manual/en/function.date.php will help you format the date. Just format the date how you want it, and then include it in the SQL query.

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

Sidebar

Related Questions

Since many PHP-related questions are very basic here, I'd propose to prepare a collection
Ok, I've asked a few related questions here and only ended up with more
From my related question here at SO I've come up with the following PHP
I've been asking similar questions here today, but I'm seeing I think the issue
After reviewing the related questions, none of them seem to address mine, so here
Question related to PHP memory-handling from someone not yet very experienced in PHP: If
I got this from php.net website. This is related to the problem I am
I think I may have found a bug in PHP's crypt() function under Windows.
I've seen this question around the internet ( here and here , for example),
Let's say I want to display the tags related to users_question_id 1 and I

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.