13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

710 Chapter 30 Building a Mailing List Manager<br />

Let’s look at the code for the display_items() function, shown in Listing 30.7.<br />

Listing 30.7 display_items()Function from output_fns.php—This Function<br />

Displays a List of Items with Associated Actions<br />

function display_items($title, $list, $action1='', $action2='',<br />

$action3='') {<br />

global $table_width;<br />

echo "";<br />

// count number of actions<br />

$actions=(($action1!='') + ($action2!='') + ($action3!=''));<br />

echo "<br />

"<br />

.$title."<br />

";<br />

// count number of items<br />

$items=sizeof($list);<br />

if($items == 0) {<br />

echo "<br />

No<br />

Items to Display<br />

";<br />

} else {<br />

// print each row<br />

for($i=0; $i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!