* Build a multidimensional array storing class information as listed below. (Each class should be stored in an array containing at least three elements: class number, title, and room.) (10 points)
o CTEC 2350 Intro to Communication Technology FAB 412
o CTEC 3350 Website Communication FAB 411
o BCMN 3319 Broadcast Management FAB 327
o BCMN 3340 Electronic News FAB 112
o ADVT 3305 Advertising Media FAB 409
* Produce a function, showClass, which will take in an argument, $prefix, and produce a class list that matches the class prefix supplied by $prefix. For example, when you call the function showClass('CTEC'), only CTEC classes will be listed.
* To demonstrate the functionality of your script, call the showClass function with the argument set to $_GET['prefix'] at the end of your script block like this: showClass($_GET['prefix']);
Here is what i have so far
Code: Select all
<?php
//multidimensional array exercise
//associative array
$clists = array ();
$clists[0] = array();
$clists[0]['Course Number'] = "CTEC 2350";
$clists[0]['Title'] = "Intro to Communication Technology";
$clists[0]['Room'] = "FAB 412";
$clists[1] = array();
$clists[1]['Course Number'] = "CTEC 3350";
$clists[1]['Title'] = "Website Communication";
$clists[1]['Room'] = "FAB 411";
$clists[2] = array();
$clists[2]['Course Number'] = "BCMN 3319";
$clists[2]['Title'] = "Broadcast Management";
$clists[2]['Room'] = "FAB 327";
$clists[3] = array();
$clists[3]['Course Number'] = "BCMN 3340";
$clists[3]['Title'] = "Electronic News";
$clists[3]['Room'] = "FAB 112";
$clists[4] = array();
$clists[4]['Course Number'] = "ADVT 3305";
$clists[4]['Title'] = "Advertising Media";
$clists[4]['Room'] = "FAB 409";
function showclass ($prefix){
}
foreach ($clists as $clist){
echo '<tr>';
foreach ($clist as $key => $value){
echo "<td>$value</td>";
}
echo '</tr>';
}
?>