I am making a simple site with php that accepts a last name from the visitor and prints out the corresponding extension number for that name. I am accessing a database for this. I have that part all set. The part I am having trouble with is the calling of the function I need to use from the HTML. It might be the placement of the php too, I am not really sure. Here is the code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
<body>
<?php
function go()
{
echo "here";
$result = mysql_query("SELECT * FROM main WHERE NAME = namefield.value",$db);
//numfield = mysql_result($result,0,"EXTENSION");
}
$db = mysql_connect("localhost", "root");
mysql_select_db("phonelist",$db);
?>
<p>&</p>
<p>Last Name <input type="text" name="namefield" size="20"><input type="submit" value="Submit" name="click" onClick="php:go()">
<p>Extension <input type="text" name="numfield" size="17"></p>
</body>
</html>
Any help would be greatly appreciated.
Thanks.
Matt


