Hold The Process ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nitediver
Forum Contributor
Posts: 109
Joined: Tue Feb 24, 2009 9:05 am

Hold The Process ?

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Hold The Process ?

Post by AbraCadaver »

Code: Select all

if(isset($_POST['submit']))
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
nitediver
Forum Contributor
Posts: 109
Joined: Tue Feb 24, 2009 9:05 am

Re: Hold The Process ?

Post by nitediver »

ok thanks...
Post Reply