Jump to content

[SOLVED] why isn't this posting?


Zeradin

Recommended Posts

It's driving me crazy. I just modified a shoutbox I made that worked and now it's not inserting the data into the tables.

if(isset($_POST['shout'])) {
$name = addslashes($_POST['name']);
$message = addslashes($_POST['message']);


$shoutquery = "INSERT INTO ybcomments (name, message, photoid) VALUES ('$name', '$message', '$id')";
$shoutresult = mysql_query($shoutquery);

echo '<meta http-equiv="Refresh" content="0;url=prpyearbook.php?id='.$id.'">';		
}
echo '<form method="POST" action="prpyearbook.php?id='.$id.'">'; ?>
				<table><tr><td>
				<strong>Name</strong></td><td>::</td><td>
				<input type="text" name="name" size="15"></td>
				<td><strong>Message</strong></td><td>::</td><td>
				<input type="text" name="message" size="35"></td><td></td><td></td><td><input type="submit" value="Do It!" name="shout" class="btn" /></td><tr></table>

Link to comment
Share on other sites

I made some non vital changes, mostly formatting, you can see them below.

 

But the only real problem I see is no closing form tag.  Also the meta tag has to be in the header.  I was thinking maybe you simplified the code to post it here.  But maybe you did not.

 

Also, where is $id coming from?

 

<?php
if(isset($_POST['shout'])) 
{
$name = mysql_real_escape_string($_POST['name']);
$message = mysql_real_escape_string($_POST['message']);

$shoutquery = "
	INSERT INTO 
		ybcomments 
	SET
		name = '$name',
		message = '$message', 
		photoid = '$id'
";
$shoutresult = mysql_query($shoutquery);

// NOTE: this has to be in the header
echo '<meta http-equiv="Refresh" content="0;url=prpyearbook.php?id='.$id.'">';      
}
?>
<form method="POST" action="prpyearbook.php?id=<?php echo $id ?>">
<table>
	<tr>
		<td><strong>Name</strong></td>
		<td>::</td>
		<td><input type="text" name="name" size="15" /></td>
		<td><strong>Message</strong></td><td>::</td>
		<td><input type="text" name="message" size="35" /></td>
		<td> </td>
		<td> </td>
		<td><input type="submit" value="Do It!" name="shout" class="btn" /></td>
	<tr>
</table>
</form>

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.