processing javascript array with PHP |
processing javascript array with PHP |
joyful |
Aug 28 2011, 01:39 PM
Post
#1
|
Advanced Member Group: Members Posts: 239 Joined: 15-November 10 Member No.: 13,147 |
Hey!
I am dynamically creating form inputs with this script: CODE var counter = 1; var limit = 40; function addInput(divName){ if (counter == limit) { alert("You have reached the limit of steps: " + counter); } else { var newdiv = document.createElement('div'); newdiv.innerHTML = "Entry " + (counter + 1) + " <br><input type='text' name='myInputs[]'>"; document.getElementById(divName).appendChild(newdiv); counter++; } } (I found the above script here) This script works great! The issue arises when I attempt to process the data with PHP: CODE $myInputs = $_POST["myInputs"]; foreach ($myInputs as $eachInput) { echo $eachInput . "<br>"; } I seem to only be able to get the contents of the first input using the above script. What am I doing wrong? Should this work? I followed the tutorial at www.randomsnippets.com exactly; yet, it seems not to work! Thanks in advance! -- |
Lo-Fi Version | Time is now: 24th April 2024 - 08:37 AM |