Welcome Guest, Not a member yet? Register   Sign In
how to pass array from view to controller
#5

You need to use multiple input with the same name and [] to tell PHP it's an array. The values will be in $_POST["mytext"].

You can find a simple tutorial here : http://www.sanwebe.com/2013/04/capture-a...-using-php

PHP Code:
<form method="post" action="collect_vals.php">
<
div class="input_fields_wrap">
 
   <button class="add_field_button">Add More Fields</button>
 
   <div><input type="text" name="mytext[]"></div>
 
   <div><input type="text" name="mytext[]"></div>
 
   <div><input type="text" name="mytext[]"></div>
 
   <div><input type="text" name="mytext[]"></div>
 
   <div><input type="text" name="mytext[]"></div>
</
div>
</
form
Reply


Messages In This Thread
RE: how to pass array from view to controller - by includebeer - 01-01-2016, 08:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB