Page 1 of 1

Hold The Process ?

Posted: Thu Mar 25, 2010 9:44 am
by nitediver
I have one page contain form and code for submission, when the page open it's automatically submit data, even the form empty.

How to prevent the page to process and insert data into database, when the page loaded to browser?

the code...

Code: Select all

 
<?
include "../conf.php";
 
$teks = $_POST['text'];
 
mysql_query("INSERT INTO article(text) VALUES ('$text')");
if(mysql_query){
echo "ok";
}else{
echo "bad";
}
 
?>
<html>
<body>
 
<form name="artikel" action="<? $PHP_SELF ?>" method="post">
<textarea name="teks" cols="100" rows="20"></textarea>
<input type="submit" name="submit">
</form>
 
</body>
</html>
 
thanks

Re: Hold The Process ?

Posted: Thu Mar 25, 2010 10:40 am
by AbraCadaver

Code: Select all

if(isset($_POST['submit']))

Re: Hold The Process ?

Posted: Thu Mar 25, 2010 10:47 am
by nitediver
ok thanks...