Note that there are some explanatory texts on larger screens.

plurals
  1. POajax form opening but not updating
    primarykey
    data
    text
    <p>I am loading a form on to a page and into a div as follows:</p> <pre><code>&lt;script type="text/javascript"&gt; $('#comments').load('/pages/includes/comments.php', { user:"&lt;?=$user?&gt;", id:"&lt;?=$id?&gt;" }); &lt;/script&gt; </code></pre> <p>The page loads fine and any comments in the system show but when i try to add new comments its simply not working, comments.php below (if i 'include' the file as opposed to ajax it works fine btw):</p> <pre><code>require '/home/php_/lib/dbconnect.inc'; $comments_id = mysql_real_escape_string($_POST['comments_id']); $comments = mysql_real_escape_string($_POST['comments']); $id = mysql_real_escape_string($_POST['id']); /*******************************************************/ /****************** add item /*******************************************************/ if ($_POST[additem] == '1'){ // AA $additem = mysql_query(" insert into comments ( id, user_id, comments ) VALUES ( '$id', '$user', '$comments' )",$db); if(!$additem) { echo "input error ".mysql_error(); exit; } // debug } // close AA /*******************************************************/ /****************** end add item /*******************************************************/ $coms = mysql_query("select * from comments where id = '$id';",$db); if(!$coms) { echo "coms error ".mysql_error(); exit; } // debug if (mysql_num_rows($coms)&gt;0){ // 55 while($databack44 = mysql_fetch_array($coms)){ // 55 echo '&lt;div style="width:100%; float:left;"&gt;'.$databack44[comments].'&lt;/div&gt;'; } } // 55 else { echo 'No Comments'; } ?&gt; &lt;form method="post" action="#"&gt; &lt;textarea name="comments"&gt;&lt;/textarea&gt; &lt;input type="submit" value="Add" class="button green"&gt; &lt;input type="hidden" name="id" value="&lt;?=$id?&gt;"&gt; &lt;input type="hidden" name="additem" value="1"&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload