This is a simple rating system. There are 3 values which contain a percentage with an accompanying description/name. I only want to display the the description/name.
For some reason, it displays:
A
T
I
This is my script:
if(isset($_POST['analyze'])) {
// get total value of "Time Management" section
for($i = 0; $i < 19; $i++) {
$time_management_total += $_POST["time_management_Q$i"];
}
// get total value of "Attract Clients" section
for($i = 0; $i < 16; $i++) {
$attract_clients_total += $_POST["attract_clients_Q$i"];
}
// get total value of "Internet Marketing" section
for($i = 0; $i < 21; $i++) {
$internet_marketing_total += $_POST["internet_marketing_Q$i"];
}
// calculate user's personal "Time Management" score
$time_management_rating = ($time_management_total / 19) / 5;
// calculate user's personal "Attract Clients" score
$attract_clients_rating = ($attract_clients_total / 16) / 5;
// calculate user's personal "Internet Marketing" score
$internet_marketing_rating = ($internet_marketing_total / 21) / 5;
// add user ratings to array
$user_rating[0] = array('percent' => $time_management_rating, 'description' => 'Time Management');
$user_rating[1] = array('percent' => $attract_clients_rating, 'description' => 'Attract Clients');
$user_rating[2] = array('percent' => $internet_marketing_rating, 'description' => 'Internet Marketing');
// reverse sort the array - highest percentage first
rsort($user_rating);
// echo the description
foreach($user_rating as $category) {
foreach($category as $description) {
echo $description[description] . "<br />";
}
}
}
?>