Jump to content

PHP Output from Form, make it look better


stepo

Recommended Posts

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

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";
}
?>

 

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";
}?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.