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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:12:49+00:00 2026-05-17T00:12:49+00:00

I have a 2 part form. The 1st form is submitted via $.post and

  • 0

I have a 2 part form.

The 1st form is submitted via $.post and (if all goes right), is replaced by a dynamically generated form from php. The idea behind this being that the 1st form creates an entry and the number of related images for said item. A new form is generated to upload said images.

My problem is that my newly generated form is not getting processed. If submit the form via the old onClick=”” function, the dynamically generated file fields are ignored.

I’m pretty new to Jquery/AJAX, so I may not be doing this correctly, but how can I get Jquery to pay attention to my 2nd (dynamically generated) form?

1st Form:

<form name="addinv" id="addinv" action="admin_process.php" method="post">
          <fieldset>
            <legend>Add Inventory</legend>
            <input type="hidden" name="actiontotake" id="actiontotake" value="none" />
            <table width="400" border="0">
              <caption>
              Add Inventory Form Layout Table
              </caption>
              <tr>
                <td><strong>Price</strong></td>
                <td><input type="text" name="price" id="price" tabindex="1" /></td>
              </tr>
              <tr>
                <td><strong>Manufacturer</strong></td>
                <td><input type="text" name="mfg" id="mfg" tabindex="2" /></td>
              </tr>
              <tr>
                <td><strong>Model</strong></td>
                <td><input type="text" name="model" id="model" tabindex="3" /></td>
              </tr>
              <tr>
                <td><strong>Serial Number</strong></td>
                <td><input type="text" name="sn" id="sn" tabindex="4" /></td>
              </tr>
              <tr>
                <td><strong>Year</strong></td>
                <td><input type="text" name="year" id="year" tabindex="5" /></td>
              </tr>
              <tr>
                <td><strong>Size (Dimensions)</strong></td>
                <td><input type="text" name="dimensions" id="dimensions" tabindex="6" /></td>
              </tr>
              <tr>
                <td><strong>Bedrooms</strong></td>
                <td><input type="text" name="beds" id="beds" tabindex="7" /></td>
              </tr>
              <tr>
                <td><strong>Bathrooms</strong></td>
                <td><input type="text" name="baths" id="baths" tabindex="8" /></td>
              </tr>
              <tr>
                <td><strong>Range Type</strong></td>
                <td><input type="text" name="range" id="range" tabindex="9" /></td>
              </tr>
              <tr>
                <td><strong>Siding Type</strong></td>
                <td><input type="text" name="siding" id="siding" tabindex="10" /></td>
              </tr>
              <tr>
                <td><strong>Roof Type</strong></td>
                <td><input type="text" name="roof" id="roof" tabindex="11" /></td>
              </tr>
              <tr>
                <td><strong>Furnace Type</strong></td>
                <td><input type="text" name="furnace" id="furnace" tabindex="12" /></td>
              </tr>
              <tr>
                <td><strong>Features &amp; Benefits</strong></td>
                <td><textarea name="fandb" id="fandb" tabindex="13"></textarea></td>
              </tr>
              <tr>
                <td><strong>Number of Pictures</strong></td>
                <td><input type="text" name="picnum" id="dimensions" tabindex="14" /></td>
              </tr>
              <tr>
                <td colspan="2" align="center"><input name="addinventorybutton" id="addinventorybutton" type="submit" value="Add Home" tabindex="15"/></td>
              </tr>
            </table>
          </fieldset>
        </form>

Jquery handler:

$(document).ready(
    function(){
        $("#addinventorybutton").click(
            function(){
               $("#actiontotake").val("Add Home");
               var dta = $("#addinv").serialize();
                           $.post("admin_process.php",dta,function(data){
                   $("div#form").html(data);
                           });
            return false;
        });
                    $("#addnewpicturesbutton").click(
            function(){
            $("#actiontotake").val("Add Picture");
            AddPic();
            return false;
        });
    });

2nd Form (via PHP & AJAX call):

<form name="addpictures" id="addpictures" enctype="multipart/form-data" method="post" action="admin_process.php">
        <fieldset><legend>Add Associated Images</legend>
        <?php 
            for($i=0;$i<$pics;$i++)
            {
                echo("<input type='file' name='pic".$i."' /><br />\n");
            }
            ?>
            <input type="hidden" name="actiontotake" id="actiontotake" value="none" />
            <input type="hidden" name="inventory_id" id="inventory_id" value="<?php echo $newid; ?>">
            <input type="button" name="addnewpicturesbutton" id="addnewpicturesbutton" value="Add Pictures to new home">
            </fieldset>
            </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-05-17T00:12:50+00:00Added an answer on May 17, 2026 at 12:12 am

    use .live() method to submit your 2nd form:

    $('#addnewpicturesbutton').live('click', function() {
          $("#actiontotake").val("Add Picture");
          AddPic();
          return false;
    });
    

    .live() attach a handler to the event
    for all elements which match the
    current selector, now or in the
    future.

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

Sidebar

Related Questions

I have a 3-part registration form using PHP: page 1 : collects info -
In my (PHP) web app, I have a part of my site that keeps
I have an input box that that is part of a form . depending
I have a form to create a Ruby on Rails object. A part of
I would like to make a php file i have a part of a
I have a form where I collect a lot of information in Rails. Part
Is there someway to have a part of the page that renders like a
In Toyota manufacturing lines they always know what path a part have traveled. Just
I have a web part with links to e.g. Manage Users i SharePoint (2003)
I have a two part question Best-Practice I have an algorithm that performs some

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.