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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:21:15+00:00 2026-06-15T17:21:15+00:00

I have an array of html textbox element with name say date_field[] . There

  • 0

I have an array of html textbox element with name say date_field[]. There could be multiple fields in the form. After submission of the form to check whether at least one of the textbox is not empty, I used –

<?php
if(empty($_POST["date_field"])){
        echo "Is empty";
    }else{
        echo "is not empty";
    }
?>

It echoed is not empty no matter whether I fill or I didn’t fill this date_field.

P.S. If I printed the form value using print_r

If I didn’t put value

[followup_date] => Array
        (
            [0] => 
        )

if I put value

[followup_date] => Array
        (
            [0] => 2012-12--14
        )

Any help will be highly appreciated

  • 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-15T17:21:17+00:00Added an answer on June 15, 2026 at 5:21 pm

    Your “empty” array contains an empty string:

    array(0 => '')
    

    That’s not an empty array. The only “empty” array is array().

    You may want to run it through array_filter, which removes all elements evaluating to false (which also includes "0", be careful).

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

Sidebar

Related Questions

I have an html document with multiple commented-out PHP arrays, e.g.: <!-- Array (
I've got this HTML form where I have multiple input elements: text, radio, and
I do have an html form that accepts textbox input of sha1 hashes per
i have an HTML array; <input class=input_box name=authors[] id=author1/> what i want to do
I have used PHP array for HTML select, then I put my codes in
I have populated an array with a few html image tags that I have
I have a javascript array: var exclude = [Santorum,Obama,Romney,Gingrich]; I have html links: <a
I have a few html image tags that fill an array. On the page
I have array of select tag. <select id='uniqueID' name=status> <option value=1>Present</option> <option value=2>Absent</option> </select>
I have a form ,in that there have a text box which can take

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.