I have a form like the one below which is posted to contacts.php, and the user can dynamically add more with jquery.
<input type="text" name="name[]" />
<input type="text" name="email[]" />
<input type="text" name="name[]" />
<input type="text" name="email[]" />
<input type="text" name="name[]" />
<input type="text" name="email[]" />
If i echo them out in php with the code below
$name = $_POST['name'];
$email = $_POST['account'];
foreach( $name as $v ) {
print $v;
}
foreach( $name as $v ) {
print $v;
}
i will get something like this
name1name2name3email1email2email3
how can i get those arrays into something like the code below
function show_Names($n, $m)
{
return("The name is $n and email is $m, thank you");
}
$a = array("name1", "name2", "name3");
$b = array("email1", "email2", "email3");
$c = array_map("show_Names", $a, $b);
print_r($c);
so my my output is like this
The name is name1 and email is email1, thank you
The name is name2 and email is email2, thank you
The name is name3 and email is email3, thank you
thank you for any help or advice