Ok below is a basic form i'm experimenting with, when i dont enter anything the error message pops up, but the form still submits...does anyone know what i'm doing wrong?....thanking in advance.
Amar
<?php
if (isset($POST['submit'])) {
$db = mysql_connect("localhost","username"); // Create an empty new variable.
mysql_select_db("test",$db);
$dvd_name=$POST['dvd_name'];
$query = "INSERT INTO dvds (dvd_name)
VALUES ('$dvd_name')";
$result = mysql_query($query);
}
?>
<html>
<body>
<head>
<script language="JavaScript">
<!--
function validate(dvd )
{
if ( document.dvd_form.dvd_name.value == "" )
{
alert ( "Please fill in the 'dvd_name' box." );
return false;
}
return true;
}
//-->
</script>
</HEAD>
<BODY>
<form name="dvd_form" method="post" >
<h1>Enter the DVD name</h1>
<p>Your Name: <input type="text" name="dvd_name"></p>
<p><input type="submit" name="submit" "value="Send Details" onClick="validate(this.dvd);"></p>
</form>
</body>
</html>