dharmistha
07-08-2005, 08:44 AM
Trying the code below to insert data into a table, the insert works properly but it gives javascript error on page. The error is 'Object doesnt this property or method'
<?
/*
db connection string goes here
*/
?>
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script language="JavaScript">
<!--
function Validate()
{
if (document.test.txtname.value=="")
{
alert("Name cannot be blank");
event.returnValue=false;
}
}
//-->
</script>
<form name="test" method="get" action="testSubmit.php" onSubmit= "Validate();" >
Name: <input type="text" name="txtname" id="txtname" value="<? echo "asdsdfsdfsdf"; ?>">
<input type="submit" name="submit" value="Submit">
<?
if (isset($_GET["submit"]))
{
/*Inserts data into a table*/
}
?>
</body>
</html>
<?
/*
db connection string goes here
*/
?>
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script language="JavaScript">
<!--
function Validate()
{
if (document.test.txtname.value=="")
{
alert("Name cannot be blank");
event.returnValue=false;
}
}
//-->
</script>
<form name="test" method="get" action="testSubmit.php" onSubmit= "Validate();" >
Name: <input type="text" name="txtname" id="txtname" value="<? echo "asdsdfsdfsdf"; ?>">
<input type="submit" name="submit" value="Submit">
<?
if (isset($_GET["submit"]))
{
/*Inserts data into a table*/
}
?>
</body>
</html>