$_POST i funktioner, overført til handling
Jeg har flere grundfejl i følgende, er der en der kan hjælpe mig med at få det til at fungere? mit main .php script skal ikke indeholde mere end det har nu ca. engine derimod er container for alt :)main.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php include("engine-eksperten.php");
$blnDebug = false;
$blnWebmaster = false;
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Søgefunktion</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<script type="text/javascript">
function enterSub(f) {
if (window.event && window.event.keyCode == 13) {
f.submit();
} else {
return true;
}
}
</script>
</head>
<body onload="document.dos.cmd.focus();">
<div id="Banner">
<img src="images/banner_simple.gif" alt="banner.gif" >
</div>
Søgefunktion <br>
<?php
engine_showDosPrompt("games.asp","GET");
if ($strCmd != "")
{
engine_EventHandler($strCmd);
}
else
{
echo ('type help for a list of commands');
}
?>
</body>
</html>
engine.php
<?php
//=====================================================================================
//Display Dos Prompt
//===============================================================================
function engine_showDosPrompt($strPage,$strMethod) {
echo ('<form action="$strPage" method="$strMethod" name="dos">' .
'<table border="0">' .
'<tr class="DosInput">' . '<td>z:\Games></td>' .
'<td><input id="dosPrompt" Class="dosInput" type="text" name="cmd" maxlength="100" onkeypress="enterSub(this.form);"></td>' .
'</tr>' .
'</table>' .
'<input class="SubmitBtn" type="hidden">' .
'</form>');
}
//=====================================================================================
//Display Help Menu
//=====================================================================================
function engine_showHelp($strMenu) {
echo (
'<table class="dosInput" border="0" width="800px" cellpadding="0" cellspacing="0">'.
'<tr><td colspan="3" style="text-decoration: underline;">Commands:</td></tr>');
if (strtoupper($strMenu)===GENERAL) {
echo ('<tr><td colspan="3"> </td></tr>'.
'<tr><td>all</td><td colspan="2">Display</td></tr>'.
'<tr><td colspan="3"> </td></tr>'.
'<tr><td>help</td><td colspan="2">This menu</td></tr>');
}
if (strtoupper($strMenu)==="LIST" || strtoupper($strMenu)==="GENERAL") {
echo ('<tr><td colspan="3"> </td></tr>'.
'<tr><td valign="top">List <span class="Parameter">char(s)</span></td><td colspan="2">
Lists Data starting with character(s).<br>Character(s) can be any alfanumeric character(s)</td></tr>');
}
if (strtoupper($strMenu) == "FIND" || strtoupper($strMenu) == "GENERAL") {
echo ('<tr><td colspan="3"> </td></tr>'.
'<tr><td valign="top">Find <span class="Parameter">search term</span></td><td colspan="2">
Find Data(s) by title or part of title</td></tr>');
}
echo '</table>';
}
//=====================================================================================
//Handle commands
//===============================================================================
function engine_EventHandler($strCommand) {
$strCmd = $_POST['cmd'];
switch ($strCmd) {
case 'a' :
engine_showHelp('GENERAL');
break;
default :
echo 'Blob';
break;
}
}
?>