I added the method , now no errors just it doesn't post anything into my DB ,,
before it added empty record now nothing , I even tried to print just text for debugging , didn't work ...
<?php
session_start();
if (!($_SESSION['name']))
{
header("Location:plogin.php");
}?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>Post Article</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="author" content="faten al saraj, Nicole Khoury" />
<meta name="keyword" content="yoga"/>
<meta name="description" content="yoga web site"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
<link href="pstyle.css" type="text/css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="button.js"></script>
</head>
<body>
<div id="logo">
<img src="image/banner2.jpg" alt="banner" />
</div>
<div id="homepage">
<a href="index.php" target="_blank" >Home</a>
</div>
<?php
require_once('lib/config.php');
$blog = new Blog();
if (!empty($_GET['submit']))
{ print 'test'.$_GET['submit'];
$title= $_POST['title'];
$body= $_POST['body'];
print $title;
print $body;
$blog->insertArticle($title,$body);
}
?>
<div id="aroundform">
<?php print "Welcome ".ucfirst($_SESSION['name']).", You are logged in.";?>
<form method="post">
<label for='title'>Title:</label>
<input type="text" size="90" name="title" id="title" /><br/><br/>
<label for="body">Article</label><br/>
<textarea rows="20" col="100" name="body" >Enter your text</textarea>
<input type="submit" name="submit" value="Post" />
</form>
</div><!-- close aroundform-->
</body>
</html>
this is my postarticle.php form
function insertArticle ($title,$body)
{
$title=addslashes($title);
$body=addslashes($body);
$sql= "insert into article (title,body) values ('".$title."','".$body."')";
$result = mysql_query($sql) or die ("Error in sql query".$sql." : ".mysql_error());
//print "title is ".$title." body is ".$body."\n";
}
and this is the function for sql statement to insert it ,
I tried many things , no change