The example code in the Module Documentation (the phone book module) throws errors due to unescaped quotes. The working code is below:
/* A simple module */
$opcode = isset($_POST['opcode']) ? $_POST['opcode']:'';
// action directive
switch($opcode) {
case 'save':
// save code here
echo 'Save action';
break;
case 'delete':
// delete code here
echo 'Delete action';
break;
case 'search':
// search code here
echo 'Search action';
break;
default: // display module page
echo '<html>';
echo '<head></head>';
echo '<body>';
echo '<script language="JavaScript" type="text/javascript">';
echo ' function postForm(opcode){';
echo ' document.module.opcode.value=opcode;';
echo ' document.module.submit();';
echo ' }';
echo '</script>';
echo '<form name="module" method="post">';
echo '<input name="opcode" type="hidden" value="" />';
echo '<h1>Phone book</h1>';
echo '<h3>Manage your contacts with ease</h3>';
echo '<hr />';
echo '<a href="javascript:;" onclick="postForm(\'save\');return false;">Save</a> | ';
echo '<a href="javascript:;" onclick="postForm(\'delete\');return false;">Delete</a> | ';
echo '<a href="javascript:;" onclick="postForm(\'search\');return false;">Search List</a> | ';
echo '<a href="javascript:;" onclick="postForm(\'\');return false;">Main</a>';
echo '</form>';
echo '</body>';
echo '</html>';
break;
}