i am using the following JQuery function to successfully POST data to the user_submit.php file, its just that the php file is unable to receive the data.
$(function() {
$("#submit_js").click(function() {
$.post("user_submit.php", {
comment: $("#comment").val()
});
});
});
upon finishing the Firebug consoloe shows this:
<html>
<body>
Your vote was successfully registered!any text but this
</body>
</html>
I am pasting the entire user_submit.php file here:
<html>
<body>
<?php
$vote = $_REQUEST['vote'];
$aid = $vote;
//$comment = $_REQUEST['#comment'];
//$comment = print_r($_POST);
$comment = htmlspecialchars($_POST["comment"]);
//$comment = $_POST['comment'];
//echo htmlspecialchars($comment);
//$comment = $_POST['comment'];
//echo $comment;
// include configuration file
include('config.php');
// open database connection
$connection = mysql_connect($host, $user, $pass) or die('ERROR: Unable to connect!');
// select database
mysql_select_db($db) or die('ERROR: Unable to select database!');
// update vote counter
$query = "UPDATE answers SET acount = acount + 1 WHERE aid = $vote";
$result = mysql_query($query);
$cadd = "INSERT INTO comments (comment,aid) VALUES ('$comment', '$aid')";
mysql_query($cadd);
// close connection
mysql_close($connection);
// print success message
echo 'Your vote was successfully registered!';
echo $comment;
//print_r(array_count_value($comment));
?>
</body>
</html>
please help me out. i have been stuck with this for hours now.
**HTML**
<div id="greetings">
You are voting out <b style="color: #00b0de;" id=roadiename></b>. Care to explain why?<br/><br/>
<textarea name="textarea" id="comment" cols="38" rows="7">textarea</textarea><br>
<a href="#" id="submit_js"><img src="images/submit.gif" style="border: none; float:right; padding-top: 10px;padding-right: 10px;"/></a>
</div>