Page 1 of 1

Class Homework using $_Get

Posted: Tue Sep 15, 2009 2:24 am
by redrocket1855
here is the assignment:
# 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)

* CTEC 2350 Intro to Communication Technology FAB 412
* CTEC 3350 Website Communication FAB 411
* BCMN 3319 Broadcast Management FAB 327
* BCMN 3340 Electronic News FAB 112
* 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. Classes should be listed in a table format.

#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']);

I am having problems with the function part of the assignment and 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 the code so far..........

Code: Select all

<body>
<table border="1">
<tr>
 <th>Class Number</th>
 <th>Title</th>
 <th>Room</th>
</tr>
<?php
$classes = array (
    array('CTEC 2350','Intro to Communication Technology','FAB 412'),
    array('CTEC 3350','Website Communication','FAB 411'),
    array('BCMN 3319','Broadcast Management','FAB 327'),
    array('BCMN 3340','Electronic News','FAB 112'),
    array('ADVT 3305','Advertising Media','FAB 409')
);
 
foreach($classes as $class)
{
 echo '<tr>';
 foreach($class as $item)
 {
  echo "<td>$item</td>";
 }
 echo '</tr>';
}
 
function showClass ($prefix){[color=#FF0040]//there should be something here i think  [/color]
                        
}
?>
</table>
</body>

Re: Class Homework using $_Get

Posted: Tue Sep 15, 2009 2:28 am
by John Cartwright
Duplicate account + Duplicate thread = Locked.

Please send me a private message with which one of your accounts you would like to keep, otherwise, the latest one will be removed within 24h.