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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:29:58+00:00 2026-06-14T00:29:58+00:00

I am a total noob with php and mysql so I hope you guys

  • 0

I am a total noob with php and mysql so I hope you guys can help me. I have a form that has a button where a user can add a set of input fields dynamically. I am using append to generate the fields. I was reading a tutorial about it so i understood that part. Here is the site where I based my append script on ,link here. My problem is how do I construct the foreach loop for the sql query if I have a set of fields and not just one input field like that website is showing as an example? Here is what my append looks like (I am just showing 4 fields but in total there is 16 fields per set of the append.) I want to upload the post data to a sql db. I’ve been searching the site but I was only seeing samples of foreach loop for a single input field not like the set that I have.

Thanks very much and I hope someone can give me an idea on how to proceed on this.

<script type="text/javascript">
    var count = 0;
    $(function(){
    $('p#add_field').click(function(){
    count += 1;
    $('#row-fluid').append(

        '<div class="span12" style="border-bottom:1px lightgray solid; padding:10px 0px;">'
            +'<div class="row-fluid"> '                         

                +'<div class="span1">'
                +'<label>&nbsp;</label>'
                +'<label class="radio"><input type="radio" id="process_where' + count + '" name="process_where[]' + '" value="Online" onClick="checkProcessType(this.value)" >Online</label>'   
                +'<label class="radio"><input type="radio" id="process_where' + count + '" name="process_where[]' + '" value="In-store" onClick="checkProcessType(this.value)" >In-store</label>'                       +'</div>'

                +'<div class="span1">'
                +'<label>&nbsp;</label>'
                +'<label class="radio"><input type="radio" id="status' + count + '" name="status[]' + '" value="Actual" onClick="checkStatus(this.value)" >Actual</label>   '
                +'<label class="radio"><input type="radio" id="status' + count + '" name="status[]' + '" value="Ghost" onClick="checkStatus(this.value)" >Ghost</label>'
                +'</div>'

                +'<div class="span1">'
                +'<label>Type</label>'
                +'<select id="upg' + count + '" name="upg[]' + '" onChange="checkExp(this.value)" class="input-small" >'
                +' <option value="" selected="&nbsp;" >&nbsp;</option>'
                +'<option value="Exp" >Exp</option>'
                +'<option value="Post" >Post</option>'
                +'<option value="Upgrade" >Upg</option>'
                +'<option value="Retail" >Retail</option>'
                +'</select>'
                +'</div>'

                +'<div id="upg' + count + '" class="span2">'
                +'<label>Full Date</label>'
                +'<input name="upg_date[]' + '" id="upg_date' + count + '" type="text" id="upg_date" placeholder="YYYY-MM-DD" class="input-small" />'
                +'<img id="jscalendar' + count + '" type="image" src="img/calendar.png" style="border-width:0px; width:16px; height:16px; background-color:#FFF; margin-bottom:-7px;" onclick="createPopCalendar3()">'
                +'</div>'
  • 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-14T00:29:59+00:00Added an answer on June 14, 2026 at 12:29 am

    And Change your php submission page like this:

    if(is_array($_POST[counter]))
    {
    $count=count($_POST[counter]);
    
    for($i=0;$i<=$count;$i++)
    {
    
    
    $process_where=$_POST["process_where".$i.""];
    $status=$_POST["status".$i.""];
    $upg=$_POST["upg".$i.""];
    $upg_date=$_POST["upg_date".i.""];
    
    if($process_where !="")
    {
    //Query Run Here
      $query="insert into tablename (process_where,status,upg,upg_date) values ('".$process_where."','".$status."','".$upg."','".$upg_date."')";
     mysql_query($query) or die(mysql_error());
    }
    
    
    
    
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

DISCLAIMER - I am total PHP noob - looking for some help/tips on how
Total PHP Noob and I couldn't find an answer to this specific problem. Hope
Total noob question. In PHP I can easily do this: foreach( $array1 as $key
I am a total noob to jQuery and Javascript.. need some help. I have
I'm a total noob trying to create a website with PHP. I created a
First timer here, and total noob when it comes to PHP and JavaScript. I
Ok, i have one totaly noob question about php sessions: I have 3 (and
Total noob here. This is my first c# attempt, its a console application that
I found some php code that was an alternative to cron I'm a total
I'm a total noob when it comes to iPhone development and have been tasked

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.