Possible Duplicate:
How do i Loop through the hidden field items and put in Session using PHP
I have a hidden Field which contains this format which contains the Set of rows separated by ‘;'(semicolon)
and each row contains some columns name separated by ‘:’ (colon) and each column value separated by ‘,’ (comma)
so my format would be ENO:123,ENAME:XYZ,SAL:1200; ENO:598,ENAME:AIR,SAL:1300; which is what stored in hidden field
So How do i grab each column such as ENO ,ENAME and SAL their values for any number of rows written to hidden field
so i have my own custom session function where i can set the key and value .So on looping the values
I should be able to put MyCustomSessionFunction(‘ENAME’,??????).How do i fill this .
I did not get Proper Replies Earlier .can anyone please help me
$hiddenformat = $_POST['hiddenfield'];
string(80) "ENO:1000,ENAME:B,SAL:10;ENO:1000,ENAME:S,SAL:100;"
when i vardump($hiddenformat) I am getting the above format .How do i explode and loop and assign each value to my
custom session function
foreach( $outer_array as $outer_key => $inner_array )
{
foreach( $inner_array as $key => $value )
{
}
}
Yeah, it was.
It’s just to say that around that, you have to explode() by “;” and in the loop use Marc’s code, since there are multiple Sets of data in the string