My requirement is, when i press on button
1)it should check whether the textbox is blank it should show alertbox to enter value and stay on that page.
2)if value is correct than check value and display message on next page.
i have developed two files they are as following.
file 1:(html & javascript code)
<html>
<head>
<title>Java Script Practical</title>
<script type="text/javascript">
function valid()
{
if(form_valid.txt1.value.length==0 || form_valid.txt1.value=="" )
{
alert("Textbox should not be blank");
}
}
</script>
</head>
<body>
<form name="form_valid" method="get" onSubmit="valid()" action="check.php">
Enter No: <input name="txt1" type="text" />
<br />
<input name="btn" type="submit" value="Submit" />
</form>
</body>
</html>
file 2: (php file)
<html>
<body>
<?php
$a=$_GET['txt1'];
if($a<0)
{
echo "no is less than 0";
}
else if($a>0)
{
echo "no is greater than 0";
}
else
{
echo "no is zero";
}
?>
</body>
</html>
this code works. but when i press on button it shows alertbox and display message on next page also. i want to make it work as my requirement as i mentioned in the starting of discussion.
please someone help to solve the problem.
thank you
Akash