what is the equivalent of ispostback(.NET) in PHP?

FirestormZero

New Member
I just start coding in PHP, i wrote my first php + mysql program for inserting data through web form. it works fine, but whenever i refresh the page, it automatically saves null record to my database.i know the solution in .NET is ispostback, but not in php? can somebody give me some idea in PHP.Code is here:\[code\]<body><form action="mySQLTest.php" method="post">First Name :<input type="text" name ="txtFirstName"/> <br/>Last Name: <input type="text" name ="txtLastName"/> <br/>Age : <input type="text" name= "txtAge" /> <br/><input type="submit"/></form><?php $con = mysql_connect("localhost","root",""); if(!$con) { die('Could not Connect:' .mysql_error()); } mysql_select_db("test", $con); if($_REQUEST[]) { $sql1 = "Insert into info(FirstName, LastName, Age) Values('$_POST[txtFirstName]','$_POST[txtLastName]','$_POST[txtAge]')"; } if(!mysql_query($sql1, $con)) { die('Error: '.mysql_error()); } else { echo "1 Record Added"; } mysql_close($con)?></body>\[/code\]
 
Top