stepo Posted April 12, 2011 Share Posted April 12, 2011 I have my form outputting the checked boxes using echo "Your Selected Markets = " . $markets ; when it comes out it is displayed as... Your Selected Markets = Aviation and Aerospace Banks Oil and Gas How can I change the output so it for example looks like this. Your Selected Markets = Aviation and Aerospace, Banks & Oil and Gas or Your Selected Markets = Aviation and Aerospace Banks Oil and Gas Quote Link to comment https://forums.phpfreaks.com/topic/233533-php-output-from-form-make-it-look-better/ Share on other sites More sharing options...
Pikachu2000 Posted April 12, 2011 Share Posted April 12, 2011 You need to change your code to echo it differently. Quote Link to comment https://forums.phpfreaks.com/topic/233533-php-output-from-form-make-it-look-better/#findComment-1200817 Share on other sites More sharing options...
stepo Posted April 12, 2011 Author Share Posted April 12, 2011 How exactly do I do that? This is what I have just now... <?php $order = null; for($i=0; $i < count($_POST["Markets"]); $i++) { $markets .= $_POST["Markets"][$i] . "\r\n"; } if(!is_null($markets)) { echo "Your Selected Markets = " . $markets ; } else { echo "order = no selection made"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/233533-php-output-from-form-make-it-look-better/#findComment-1200825 Share on other sites More sharing options...
spiderwell Posted April 12, 2011 Share Posted April 12, 2011 heya buddy hows the assignment coming along! use some simple formating of html into your echoed php. here i have turned it into a list for you <?php $order = null; for($i=0; $i < count($_POST["Markets"]); $i++) { $markets .= "<li>" . $_POST["Markets"][$i] . "</li>"; } if(!is_null($markets)) { echo "Your Selected Markets are: <ul> " . $markets . "</ul>"; } else { echo "order = no selection made"; }?> Quote Link to comment https://forums.phpfreaks.com/topic/233533-php-output-from-form-make-it-look-better/#findComment-1200840 Share on other sites More sharing options...
Pikachu2000 Posted April 12, 2011 Share Posted April 12, 2011 I don't have enough information to be sure this is all you need, but this would be much more concise. echo "Your Selected Markets:<br>\n" echo implode( "<br>", $_POST['Markets'] ); Quote Link to comment https://forums.phpfreaks.com/topic/233533-php-output-from-form-make-it-look-better/#findComment-1200841 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.