Hi Guys,
I am very new to this forum, but a friend recommended it so here i am.
My Problem
I want to be able to search my MySQL database for a specific value, from a users input into a text field.
my code is basic at the moment.
srch1.htm
<form action="srch1.php" method="post">
<p>Your Username: <input type="text" name="User" /></p>
<p><input type="submit" /></p>
</form>
I then want to use the "User" input to search the database using the following php
srch1.php
<?php
// Connect to Database
mysql_connect("DELETED", "DELETED", "DELETED") or die(mysql_error());
mysql_select_db("DELETED") or die(mysql_error());
//Sets Up Query... this one shows all items booked on a specific day
$data = mysql_query("SELECT * FROM Booking WHERE Date =$_POST['User']")
or die(mysql_error());
// Displays Result
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<th>Entry Id:</th> <td>".$info['EntryID'] . "</td> ";
Print "<th>Date:</th> <td>".$info['Date'] . "</td> ";
Print "<th>Day:</th> <td>".$info['Day'] . "</td> ";
Print "<th>Month:</th> <td>".$info['Month'] . "</td> ";
Print "<th>Year:</th> <td>".$info['Year'] . "</td> ";
Print "<th>User:</th> <td>".$info['name'] . "</td> ";
Print "<th>Horse:</th> <td>".$info['Horse'] . "</td> ";
Print "<th>Notes:</th> <td>".$info['Notes'] . " </td></tr>";
}
Print "</table>";
?>
</body>
</html>
The error i get is
Parse error: syntax error, unexpected T_STRING in /home/st1132/public_html/website_v3_sgray/tabletestday6.php on line 25
Any Help would be greatly appreciated.
Thank you in advance
Cescesc 😕