Forum Moderators: coopster
I think I am sure this is not at all tough to achieve, but since I have already wasted 3-4 hours please help me out with this.
I am submitting data from a form as $_POST being an array. Now I want two vars:
$fields = "name,username,password";
$values = "Juanty,jaunty,test";
I have done what not to get the values and keys in the variables but no luck. I can even print the values but not able to store them in a variable.
I am sure this should be super easy, please help.
Regards,
Jaunty
/*
//Edit: Found the function for it, use the above
$array = array();
foreach ($a1 as $k=>$v) {
$array[$v] = $a2[$k];
}
*/
Not sure if there's a built in function, but that should achieve what you want.
sorry if I did not make this clear before,
$fields = "name,username,password";
$values = "Juanty,jaunty,test";
is the desired output, actually I have a form with 3 input fields named: name, username, password and if I fill the values as Jaunty, jaunty, test I want to get these values in the variables $fields and $values.
Also the form is dynamically generated so there might be 3-5- or even 10 fields.
Regards,
Jaunty