I have a simple database with 4 fields
ID
name
company
position
I have a form that when the user enters a name it should display all records that match that name.
this is my form (its very simple)
<form name="form1" method="POST" action="action.php">
<p> name: <input name="name" type="text" id="name">
<p><input type="submit" name="submit" value="submit">
</form>
this is my action.php
<?
$host = "db.database.com";
$user = "user";
$pass = "password";
$dbname = "data";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);
$query = "select * from eagle where name=" . $_POST['name'] . "'";
echo $sql;
$query = mysql_query($sql);
while ($row = mysql_fetch_array($query)) { echo "<p>",$row['name'],":",$row['company'],":",$row['position']; }
?>
can you tell me what I am doing wrong?