In a form I have where an admin user can create a new config array element for any changes he makes to scripts.
The possiblity exists to create a multi-dimensional array element by entering in the textarea
Which when the submit button is pressed will create a line in the config script:
Which functionally is fine for the code BUT it cannot be modified without actually opening the config script directly (the display and editing script shows each element seperately with its value). So I decided to have each element of the array written to the file on its own line. The problem is that the array code (first box above) I can't seem to get it from the POST into a variable so I can use a foreach loop on it. I have tried eval() and parse_str() and neither have worked. I keep getting "Invalid Argument supplied to foreeach()"
What I'm looking for in final is an output that looks like this:
Anyone have an idea of how to get the code pased?
JRSofty
The possiblity exists to create a multi-dimensional array element by entering in the textarea
Code:
array('arr1'=>array('a'=>1,'b'=>3,'c'=>5),'arr2'=>array('a'=>2,'b'=>4,'c'=>6))
Which when the submit button is pressed will create a line in the config script:
Code:
$CONFIG['some_element']=array('arr1'=>array('a'=>1,'b'=>3,'c'=>5),'arr2'=>array('a'=>2,'b'=>4,'c'=>6))
Which functionally is fine for the code BUT it cannot be modified without actually opening the config script directly (the display and editing script shows each element seperately with its value). So I decided to have each element of the array written to the file on its own line. The problem is that the array code (first box above) I can't seem to get it from the POST into a variable so I can use a foreach loop on it. I have tried eval() and parse_str() and neither have worked. I keep getting "Invalid Argument supplied to foreeach()"
What I'm looking for in final is an output that looks like this:
Code:
$CONFIG['some_element']['arr1']['a']=1;
$CONFIG['some_element']['arr1']['b']=3;
$CONFIG['some_element']['arr1']['c']=5;
and so on...
Anyone have an idea of how to get the code pased?
JRSofty