Jump to content

adding into database


Lone_Ranger
Go to solution Solved by Lone_Ranger,

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.