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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:20:32+00:00 2026-05-23T09:20:32+00:00

So I have a form that can increase and decrease according to what the

  • 0

So I have a form that can increase and decrease according to what the user adds to the page. To be able to handle unknown posts, I have set up a series of foreach loops that goes through each section in the table and unravels the array for each.

The form is a series of tables. Each table is for one category, and each row is a different part of it. Every row has 7 parts to it. The script circles through and gets the parts necessary to insert each column piece into the database.

On my personal home server the code returns no error and updates the database accordingly. On my paid hosting though I get an error. The error comes in after the the first foreach. It comes in at:

foreach($tablecontent as $key => $values)

This is the error:
Warning: Invalid argument supplied for foreach() in /home/sariep5/public_html/werchris.com/circuitcheck/submit.php on line 14

My code is below:

<td><input type="text" maxlength="3" name="esd[8][eng]" value=""></td>
<td><input type="text" maxlength="3" name="esd[8][q2]" value=""></td>
<td><input type="text" maxlength="3" name="esd[8][loa]" value=""></td>
<td><input type="text" maxlength="3" name="esd[8][wire]" value=""></td>
<td><input type="text" maxlength="3" name="esd[8][verify]" value=""></td>
<td><input type="text" maxlength="3" name="esd[8][assy]" value=""></td>
<td><input type="text" maxlength="3" name="esd[8][q4]" value=""></td>

That is the HTML part of the form. Sections just like that are created only with different parts to the name. So esd could be any other category, 8 increments, and the other 7 are the same in every section.

foreach ($_POST as $table => $tablecontent) { 
    foreach($tablecontent as $key => $values) {
        foreach($values as $row => $value) {
            $value = strip_tags(htmlspecialchars($value));
            $row = strip_tags(htmlspecialchars($row));
            $key = strip_tags(htmlspecialchars($key));
            mysql_query("UPDATE tablecontent SET ".$row." = '$value'
                         WHERE id='$key'");
        }
    } 
}

Thanks!

  • 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-23T09:20:32+00:00Added an answer on May 23, 2026 at 9:20 am

    That’s simple foreach($tablecontent as $key => $values) error there means $tablecontent isn’t an array

    Warning: Invalid argument supplied for foreach() in /home/sariep5/public_html/werchris.com/circuitcheck/submit.php on line 14

    Try a var_dump($tablecontent); there

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

Sidebar

Related Questions

I have a view user control that can post form. This control can be
I have made an normal form that you can enter a user´s fullname in
I' have form that user can select a color. I'm writing that color to
Using web forms I know that you can only have one ASP.NET form on
I have a UserControl that consists of three TextBoxes. On a form I can
I have form that displays several keywords (standard set of choice lists that changes
i have created a form that can send and email with a specified attachment,
I have a web form that users can fill out and that content fills
I have a form that allows the user to add information an their leisure.
I have complex form that I want to make more user friendly. It consists

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.