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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:13:18+00:00 2026-06-02T00:13:18+00:00

how would I do an if / else statement for such? the user has

  • 0

how would I do an if / else statement for such? the user has the option of adding images or not. if the add images, i want the if to run and if they dont I want the else to run because depending on whether or not the add an image they will have two different end.

if (isset($_POST['formsubmitted'])) { 

if (isset($_POST['name'])){  }else{  }

if (isset($_POST['state'])){  }else{  }

if (isset($_FILES['images']['name'])) { echo 'images'; exit;} else {echo 'no images'; exit;}


} #end main form submitted

if (isset($_FILES[‘images’][‘name’])) dosnt work because as of now even when no images are submitted it still says images submitted.

the html file fields are:

<form>
<input type='file' name='images[]' id=''>
<input type='file' name='images[]' id=''>
<input type='file' name='images[]' id=''>
<input type = "submit">    
</form>
  • 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-02T00:13:19+00:00Added an answer on June 2, 2026 at 12:13 am

    You should try this

    Submit.php

    <pre>
    <?php 
    // those index are empty the array filter remove this 
    
    echo "without filter"."<br>";
    print_r($_FILES['images']['name']);
    
    echo "filter"."<br>";
    $usersFileUpload = array_filter($_FILES['images']['name']);
    print_r($usersFileUpload);
    
    $usersFileUploadCount = count($usersFileUpload);
    
    for($i=0;$i<=$usersFileUploadCount;$i++){
        echo $usersFileUpload[$i]."<br>";
    
        // insert Table     
    }
    ?>
    

    HtmlForm.php

    <form action="submit.php" method="post" enctype="multipart/form-data" name="images">
    <input type='file' name='images[]' id=''><br />
    <input type='file' name='images[]' id=''><br />
    <input type='file' name='images[]' id=''>
    <input name="" type="submit" />
    </form>
    

    See the image for verification 1

    enter image description here

    See the image for verification 2

    enter image description here

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

Sidebar

Related Questions

I would like to determine whether or not a variable has any text at
I would like to return multiple values in my case statement, such as :
I want to join a list with a conditional statement such as: str =
I mean would it be bad practice if I want an if statement to
I want to avoid using tagged classes and big if-else blocks or switch statement
I would like to download documentation of the Drupal hooks, and whatever else would
I would like to know how Gmail (or anyone else) does comet on Opera.
For my school project, I would like to build a gui that someone else
Would it be possible to add a new operator to the String class that
Would like to be able to set colors of headings and such, different font

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.