Hi,
When I click the submit button on the form without entering any text all the data from my database appears.
How can I have it so when submit is clicked without any text entered (so an empty text box) NOTHING happens and NO data appears.
<html>
<body>
James' New Site
<form action="seaside.php" method="post">
<input type="text" name="search"><br>
<input type="submit">
</form>
<hr width="100%"></hr>
</body>
</html>
<?php
$search = "%" . $_POST["search"] . "%";
mysql_connect ("", "", "");
mysql_select_db ("");
$query = "SELECT name,msg FROM contact WHERE name LIKE '$search'";
$result = mysql_query ($query);
if ($result) {
while ($row = mysql_fetch_array ($result)) {
echo "<br>$row[0]</br>";
echo $row[1];
}
}
?>
Thanks!
James