Jump to content

Can anyone see why this is not outputing any dynamic html


madspof

Recommended Posts

Hi i have this bit of php and it is supposed to output a dynamic menu but it does not output anythink can anyone see were i am gonig wrong here is the script:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
function generate_menu($MENU, $options, $default="") {
$html = "<SELECT NAME=\"$name\">";
foreach($options as $value => $label){
$html .= "<OPTION ";
if ($value == $default)
$html .= "SELECTED ";
$html .= "VALUE=\"$value\">$label</OPTION>";
}
$html .= "</SELECT>";
return($html);
}
?>
</p>
</body>
</html>
You have just placed a php function in the body of the html. It will not return anything unless you call it. I suggest you read up about PHP funtions and what they do.

PHP Documentation - [url=http://www.php.net]www.php.net[/url]

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.