These are the post variables.
How can I put these in loop?
Where 'master_customer_id' and 'firstname' are the name attributes and the array in them is the values retrieved and I need to save these values to the database.
Values are dynamic, means to say array could go upto any number, here I'm just saying 3 key value pairs.
Thank you in advance.
array
'master_customer_id' =>
array
0 => string '1' (length=1)
1 => string '1' (length=1)
2 => string '1' (length=1)
'firstname' =>
array
0 => string 'a' (length=1)
1 => string 'a' (length=1)
2 => string '' (length=0)
I am also adding the form
<?php
for($i=1;$i<=3;$i++){
?>
<input type="hidden" name="master_customer_id[]" value="1" />
First Name: <input type="text" value="" name="firstname[]"/><br/>
<?php } ?>
foreachto loop through arrays. You can nest them.Values are dynamic, means to say array could go upto any numberthen how are you going to save them in database columns? Please provide a hint of your database schema