Hi all,
I have a regular comment section and i want the submit button to call a mysql_query function in comment.class.php
so
<form method="post" action="../php/comment.class.php?action=addcomment" name="commentform" id="commentform" onsubmit="validateForm()">
<label for "body">Your Comment</label>
<div><textarea cols="20" rows="4" name="body" id="body"></textarea></div>
<input type="submit" id="submit" value="Submit"/>
and my comment.class.php is...
function addcomment($body){
$body=mysql_real_escape_string($_POST['body']);
if($body!=''){
mysql_query("INSERT INTO comment(uid,screenname,body) VALUES ('$_SESSION[uid]','$_SESSION[screenname]','$body')") or die('lame');
}
header("location:../index.php");
}
but when I click submit, i'm taken to a blank page with the URL: http://test/php/comment.class.php?action=addcomment
any tips? and is there a better alternative to header?
Thanks