I want the form to be submitted when pressed enter...
This is what I got already
...
<script language="JavaScript">
NS4 = (document.layers) ? true : false;
function checkEnter(event)
{
var code = 0;
if (NS4)
code = event.which;
else
code = event.keyCode;
if (code==13)
document.search_type.submit();
}
</script>
<form name="search_type" method="post" action="<?php echo($PHP_SELF) ?>">
<tD width="250">Enter a typename of part of a type</tD>
<tD><input name="search_type" type="text" maxlength="30" onKeyPress="checkEnter(event)"></tD>
<td><input name="submit" type="submit" value="Search"></td>
<tD width="250">Use <strong>%</strong> as a wild card (same as *)</tD>
</form>
So far I think it's good, but now comes the tricky thing...
if ($HTTP_POST_VARS["submit"]=="Search")
{ $error = search_data($HTTP_POST_VARS);
if ($error == ""){
$success = "Search completed" ;
}
else {
print $error;
}
}
How can I let the same page know the submit button==Search ???
Hope you guyz can help me...
I would really appreciate it