FooKelvin Posted January 13, 2016 Share Posted January 13, 2016 Hi All, Have look with this codes $tableHeads = "<tr><th>" . join('</th><th>', $names) . "</th></tr>\n"; if i echo $tableHeads, the data can be echo out. my question is there any way to echo it out without the .join. statement? instead of tr,th.. i need them to me input. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/300303-php-array-not-printed-out/ Share on other sites More sharing options...
Barand Posted January 13, 2016 Share Posted January 13, 2016 to do the same without the join() you could $tableHeads = '<tr>'; foreach ($names as $n) { $tableHeads .= "<th>$n</th>"; } $tableHeads .= '</tr>'; echo $tableHeads; 1 Quote Link to comment https://forums.phpfreaks.com/topic/300303-php-array-not-printed-out/#findComment-1529556 Share on other sites More sharing options...
cyberRobot Posted January 13, 2016 Share Posted January 13, 2016 instead of tr,th.. i need them to me input. So are you looking to create form input fields for each name? If so, you can do something like this: <?php foreach($names as $currName) { echo '<input name="name[]" value="' . $currName . '">'; } ?> 1 Quote Link to comment https://forums.phpfreaks.com/topic/300303-php-array-not-printed-out/#findComment-1529574 Share on other sites More sharing options...
FooKelvin Posted January 14, 2016 Author Share Posted January 14, 2016 Hi All, Both of you a perfect !!! Thank you so much! Quote Link to comment https://forums.phpfreaks.com/topic/300303-php-array-not-printed-out/#findComment-1529615 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.