/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
 <?php $arrPerson['name'] = 'Piet'; $arrPerson['lastname'] = 'Janse'; $arrPerson['address'] = 'Thuisstraat 35'; $arrPerson['zipcode'] = '1111AA'; $arrPersons[] = $arrPerson; $arrPerson['name'] = 'Jan'; $arrPerson['lastname'] = 'Slagerszoon'; $arrPerson['address'] = 'Straat 135'; $arrPerson['zipcode'] = '1111AA'; $arrPersons[] = $arrPerson; $strCSV = ''; //Create titles from first record { foreach($arrPersons[0] as $strField => $strValue) { $arrColomns[] = $strField; } } "; //fill rows { $strRows = ''; foreach($arrPersons as $arrPerson) { { $i = 0; foreach($arrColomns as $strColomn) { $arrRow[] = $arrPerson[$strColomn]; } "; } } } echo $strCSV;
Comments
                    Subscribe to comments
                
                