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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:55:00+00:00 2026-06-05T11:55:00+00:00

I have a form that allows the user to add more form fields if

  • 0

I have a form that allows the user to add more form fields if needed. I need to post the values through php in an email, but it keeps coming back as “array” instead of the values. I am a novice and just can’t figure out the problem.

Here is the javascript:

    var counter = 1;
    var limit = 50;
    function addInput(divName){
        if (counter == limit)  {
          alert("You have renter code hereeached the limit of adding " + counter + " inputs");
     }
     else {
          var newdiv = document.createElement('div');
          newdiv.innerHTML = "Entry " + (counter + 1) + " <br><input type='text' name='myInputs[]'>";
          document.getElementById(divName).appendChild(newdiv);
          counter++;
     }
}

Here is the html form (I deleted most of it to save time):

    <form id="teamreg" class="appnitro"  method="post" action="teamreg.php" >
        <input name="recipient" type="hidden" id="recipient" value="kim@ka-kingdesigns.com" />
        <ul>
            <li>
                <h3>Contact Information</h3>
            </li>   
            <li id="li_1" >
                <label class="description" for="company">Company/Organization </label>
                <div>
                    <input id="company" name="company" class="element text large" type="text" maxlength="255" value=""/> 
                </div> 
            </li>

            <li id="li_3" >
                <label class="description" for="contactname">Team Cooridinator</label>
                <span>
                    <input id="element_2_1" name= "contactname_1" class="element text" maxlength="255" size="8" value=""/>
                    <label>First</label>
                </span>
                <span>
                    <input id="element_2_2" name= "contactname_2" class="element text" maxlength="255" size="14" value=""/>
                    <label>Last</label>
                </span> 
            </li>       

<li class="section_break">
            <h3>Team Members</h3>
            <p>Please list everyone planning on volunteering (including spouses, children, etc.)<br/>
</p>
        </li>

<li>
<div id="dynamicInput">
          Entry 1<br><input type="text" name="myInputs[]">
     </div>
     <input type="button" value="Add another text input" onClick="addInput('dynamicInput');">


</li>
            <li class="buttons">
                <input type="hidden" name="form_id" value="421421" />

                <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
        </li>
            </ul>
        </form> 

Here is the php:

header("location: registrationthankyou.html");
$company = $_POST['company'];
$coordinator = "{$_POST['contactname_1']} {$_POST['contactname_2']}";
$myInputs = $_POST['myInputs'];
foreach ($myInputs as $eachInput) {
     echo $eachInput . "<br>";
}
$to = $_POST['recipient']; //"user@example.com";
$subject = "Day of Caring Team Registration".$_POST['subject'];
$comments = "
<strong>Company:</strong> {$company}<br>
<strong>Team Coordinator:</strong> {$coordinator} <br>
<strong>Team Members</strong> {$myInputs}<br><br>
mail($to,$subject,$comments,"From: $from\r\n"
    ."Reply-To: $from\r\n"
    ."Content-Type: text/html; charset=iso-8859-1\n" 
    ."X-Mailer: PHP/" . phpversion());
  • 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-05T11:55:02+00:00Added an answer on June 5, 2026 at 11:55 am

    Change:

    <strong>Team Members</strong> {$myInputs}<br><br>
    

    To:

    <strong>Team Members</strong> ".implode(",", $_POST['myInputs'])."<br /><br />
    

    The code you have included in the following is not doing anything for your email:

    foreach ($myInputs as $eachInput) {
         echo $eachInput . "<br>";
    }
    

    You can do:

    foreach ($myInputs as $eachInput) {
         $message .= $eachInput . "<br>";
    }
    

    And then update the email message to reflect {$myInputs} to {$message}

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

Sidebar

Related Questions

I have a bound form in microsoft access that allows a user to add
I have a form that allows the user to add as many upload forms
I have a product registration form that allows the user to add additional product
I am working on a PHP form that allows a user to add rows
I have a form that allows the user to add information an their leisure.
I have a form that allows a user to import a spreadsheet. This spreadsheet
I have a dynamic form that allow to add many fields dynamically, I Know
I have a form that allows a user to update their profile information, but
I have an events form that allows someone to add a new event. An
I have a view function that allows a user to Add / Edit /

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.