darksniperx Posted November 26, 2007 Share Posted November 26, 2007 What I would like to do this. I need to create a way to generate html code with a button click. For example, I would like to create a list of people's name with their emails and remove any of them at any time. part of the code would look something like this: <a href="javascript:add();">Add Field</a> <div id='people'> Name:<input type='text' name='name[]' /> Email:<input type='text' name='email[]' /><a href="javascript:remove();">Remove Field</a><br/> </div> When ever someone clicks add field, the code adds the following line inside div tag When ever someone clicks remove field, the code will remove that its line from div tag. the second part, is that I would like to pass the array to of name and email to php and work with them foreach($_POST['name'] as $name, $_POST['email'] as $email) { // do the following } and also that they would be synchronized together, that email would belong to the to its name and not to any other onces in the array. original post: http://www.phpfreaks.com/forums/index.php/topic,169355.0.html Quote Link to comment https://forums.phpfreaks.com/topic/79012-creating-and-passing-an-array-from-input-tag-to-php/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.