Looks like a problem in the PHP/SQL...

1. Make sure $vote is an integer else you will have to wrap it in ''
inside the SQL UPDATE statement.
2. The INSERT statement should wrap like this ... INSERT INTO
`table_name` (`column1`,`column_2`) VALUES ('$value_1','$value_2')
3. You can save yourself a few lines of code (which you will need to
sanitize your input's from the request) by using....
    $insert=mysql_query("INSERT INTO.....");

  if(!$insert) {
// means something went wrong
exit("Something went wrong ERR:" .mysql_error());
}



On Dec 21, 11:55 pm, Juan Ignacio Borda <juanignaciobo...@gmail.com>
wrote:
> try a var_dump($_REQUEST) to see what's being submited.
>
> -------- Original Message --------
> > 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 user_submit.php here:
>
> > <?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));
>
> > ?>
>
> > this is the 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>
>
> > When I click on Submit, I can see in Firebug console that the data is
> > being POSTed. but i am not receiving that data in the php file. or
> > else i am not able to use it.
>
> > please help.
>
>
>
>  juanignacioborda.vcf
> < 1KViewDownload

Reply via email to