Lone_Ranger Posted December 7, 2013 Share Posted December 7, 2013 I cannot get these field to add into my database from the text area box. I am using an image as the submit button but when I have entered everything in nothing submits into the right fields on the database. <form action=http://www.sentuamessage.com/profile.php?action=post method=post> <table border=0 width=80% cellspacing=0 cellpadding=0> <tr> <td> <table border=0 width=89% cellspacing=0 cellpadding=0> <tr> <td width=10 valign=top> </td> <td width=52 valign=top> <table border=0 width=100% cellspacing=0 cellpadding=0> <tr> <td height=6> </td> </tr> <tr> <td> <img border=0 src=commentsavatar.jpg width=52 height=54></td> </tr> <tr> <td> </td> </tr> </table> </td> <td width=10 valign=top> </td> <td valign=top> <table border=0 width=87% cellspacing=0 cellpadding=0> <tr> <td> <img border=0 src=commenttop.jpg width=921 height=19></td> </tr> <tr> <td background=commentmiddle.jpg> <table border=0 width=100% cellspacing=0 cellpadding=0> <tr> <td width=19> </td> <td> <table border=0 width=100% cellspacing=0 cellpadding=0> <tr> <td> <textarea type=text name='comment'cols=107 rows=8 style='outline: none; overflow: hidden; border: none'></textarea></td> </tr> <tr> <td> <p align=right> <input type=image name=cmdSubmit alt=Submit Form src=commentpost.jpg value=Submit border=0> </form></td> </tr> </table> </td> <td width=22> </td> </tr> </table> </td> </tr> <tr> <td> <img border=0 src=commentbottom.jpg width=921 height=19></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> What are the +1 or +2? what I am trying to do here is trying to use the current number in that field and add an additional 1 or 2 to that current figure. so the whole action=post code is if($action == "post") { if($_POST['comment']==""){ echo "<p align=center>Your comment was not posted due to the comment box being empty. You should be redirected back to your page in a few seconds</p>"; } else { mysql_query("INSERT INTO comments (id, userid, topicid, topicname, comment, date, name) VALUES ('', '$_SESSION[id]', '$content[id]', '$content[name] Profile', '$_POST[comment]', '$today', '$_SESSION[username]')") or die(mysql_error()); mysql_query("UPDATE userdb SET score='$_SESSION[score]+2', comments='$_SESSION[comments]+1' WHERE username='$_SESSION[username]'") or die(mysql_error()); echo "<p align=center>Your comment has been submitted. You should be redirected back to your page is a few seconds</p>"; } include("bottom.php"); exit; } Link to comment https://forums.phpfreaks.com/topic/284596-adding-into-database/ Share on other sites More sharing options...
hitman6003 Posted December 7, 2013 Share Posted December 7, 2013 Is any error output? Try adding some debug output...for example, check your $_POST and query: print '<pre>' . print_r($_POST, 1); print "my query is: INSERT INTO comments (id, userid, topicid, topicname, comment, date, name) VALUES ( '', '$_SESSION[id]', '$content[id]', '$content[name] Profile', '$_POST[comment]', '$today', '$_SESSION[username]' )"; Does it look like you expect it to? Link to comment https://forums.phpfreaks.com/topic/284596-adding-into-database/#findComment-1461545 Share on other sites More sharing options...
Lone_Ranger Posted December 8, 2013 Author Share Posted December 8, 2013 wasn't that but I have sorted it out seems like where I been placing my { or } that caused the problems until I corrected it and revised it Link to comment https://forums.phpfreaks.com/topic/284596-adding-into-database/#findComment-1461645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.