Hi,
When data is filled in a Form, I want to copy values from POST array to another array. I need the KEYS of my new array to be exactly same as that of POST. Can I use foreach loop to accomplish this?
Example: Form has 50 text fields Text1, Text2,....Text50
$formData =array();
$formData['Text1']=$POST['Text1'];
$formData['Text2']=$POST['Text2'];
//...... so on
$formData['Text50']=$_POST['Text50'];
Can I achieve this using a for each loop:
foreach ( $_POST as $key => $value )
{
$formData[$key] = $value
}
Please help!
Thanks.