Post Data Not Posting In IE And Firefox, Why?

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 3590 Views - Last Post: 15 October 2012 - 09:11 PM Rate Topic: -----

#1 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 761
  • Joined: 31-August 11

Post Data Not Posting In IE And Firefox, Why?

Posted 13 October 2012 - 06:54 PM

So this is confusing I have my own comment system on one part of my site and on comments that the user posts there's an X image that lets the user delete their own comment individually. This works find in GOOGLE CHROME but other browsers it does NOT!! Here's the code


 while ($comments->fetch())
		 {
			echo '<div class="Comment">';
			echo '<div class="YourComment">';
			if ($poster == $viewer)
			{
		    //area for buttons etc if it's the posters comments
			echo '<form name="CommentDelete" action="ClickDelete.php" method="post" />';
			echo '<input type="image" name="DelComment" value="' . $cid .'" src="/images/delete.png"' . ' title="Remove Your Comment" ' . 'onclick="return confirm(' . "'Delete Comment?')" . ' "/>';
			echo '</form>';
		    echo '</div>';			
			echo  BBCode_CommentData(stripcslashes($comment));
			echo '</div>';
			}
			else
			{
			  echo '</div>';
			  echo  BBCode_CommentData(stripcslashes($comment));
			  echo '</div>';
			}



Basically it looks at the poster of the comment and matches this with the currently in session username this ALL WORKS FINE again on CHROME FURTHER the value if the unique comment ID to be deleted so here's the PDO code in the action script

try
{
$dbh = MY CONNECTION DETAILS
}
catch(PDOException $e)
{
   echo 'Connection failed: ' . $e->getMessage();
   exit();
}
$query = "DELETE FROM comments WHERE ID=? AND poster=?;";
$stmt = $dbh->prepare($query);
$stmt->bindParam(1,$comment_id,PDO::PARAM_INT);
$stmt->bindParam(2,$username,PDO::PARAM_STR);
if ($stmt->execute())
{
    header("Location:View-Review.php?ID=" . $ID . "&PostMsg=" . $comment_id);
	exit();
}




You will note that I want a different header outcome before all is finished but the $comment_id on firefox an IE apparently are NULL since they show nothing whilst on chrome they do.

What don't I know here and what am I doing wrong? I don't get it!!

Is This A Good Question/Topic? 0
  • +

Replies To: Post Data Not Posting In IE And Firefox, Why?

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2934
  • View blog
  • Posts: 10,151
  • Joined: 08-August 08

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 13 October 2012 - 08:26 PM

Have you validated the HTML (not the php mixed with it, but the processed and sent information) that the browser sees?
Was This Post Helpful? 1
  • +
  • -

#3 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 761
  • Joined: 31-August 11

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 01:49 AM

View PostCTphpnwb, on 13 October 2012 - 08:26 PM, said:

Have you validated the HTML (not the php mixed with it, but the processed and sent information) that the browser sees?


Forgive me I don't know what that means or how to use that tool? The page only outputs this html part for the forum is the user is logged in and they are seeing their comment? I'm confused? I ran that tool anyway copying and pasting the source code and it says

 Line 118, Column 270: end tag for element "form" which is not open
…n confirm('Delete Comment?') "/></form></div><b><a href="forum/memberlist.php?



It is open though from the <form I don't get what this means or if this is what is causing the error?

Here's the raw HTML on the page for example in a comment that all that's in the text of the comment is 23 i.e. I was using this for a test and the value for the comment id is correct etc. Note again it works in Chrome but not Firefox and Ie

<div class="Comment"><div class="YourComment"><form action="ClickDelete.php" name="CommentDelete"  method="post" /><input type="image" name="DelComment" value="59" src="/images/delete.png" title="Remove Your Comment" onclick="return confirm('Delete Comment?') "/></form></div><b><a href="forum/memberlist.php?mode=viewprofile&amp;u=1" class="bbcode_url">admin</a>: Posts At: 10/13/2012 - 8:29pm</b><br />
23<br />

This post has been edited by adn258: 14 October 2012 - 02:09 AM

Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,495
  • Joined: 23-August 08

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 02:59 AM

Quote

<form action="ClickDelete.php" name="CommentDelete"  method="post" />


You're closing your form in the opening tag.
Was This Post Helpful? 2
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3525
  • View blog
  • Posts: 10,171
  • Joined: 08-June 10

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 03:40 AM

that would be ignored, unless XHTML is used.
Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,495
  • Joined: 23-August 08

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 04:22 AM

But that seems to be the reason for the validation error, right?
Was This Post Helpful? 0
  • +
  • -

#7 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3525
  • View blog
  • Posts: 10,171
  • Joined: 08-June 10

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 09:16 AM

a validator certainly would recognise this error.
Was This Post Helpful? 1
  • +
  • -

#8 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 761
  • Joined: 31-August 11

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 01:34 PM

View PostJackOfAllTrades, on 14 October 2012 - 02:59 AM, said:

Quote

<form action="ClickDelete.php" name="CommentDelete"  method="post" />


You're closing your form in the opening tag.


Closing the forum before the opening tag? Sorry I don't get it friend?
<form action="ClickDelete.php" name="CommentDelete"  method="post" />
</form>



is correct right? How am I wrong here it's closed with </form>? Forgive me if I sound like an idiot here.
Was This Post Helpful? 0
  • +
  • -

#9 Sho Ke  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 110
  • View blog
  • Posts: 250
  • Joined: 13-October 11

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 01:39 PM

Line 1:
<form action="ClickDelete.php" name="CommentDelete"  method="post" />

Forms aren't self-closing.

This post has been edited by Sho Ke: 14 October 2012 - 01:39 PM

Was This Post Helpful? 1
  • +
  • -

#10 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 761
  • Joined: 31-August 11

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 02:18 PM

View PostSho Ke, on 14 October 2012 - 01:39 PM, said:

Line 1:
<form action="ClickDelete.php" name="CommentDelete"  method="post" />

Forms aren't self-closing.


I still don't get it you want me to remove the / from it? so it's like > instead of /> because I tried that?
Was This Post Helpful? 0
  • +
  • -

#11 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2934
  • View blog
  • Posts: 10,151
  • Joined: 08-August 08

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 02:41 PM

And what other errors did the validator point out?
Was This Post Helpful? 1
  • +
  • -

#12 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 761
  • Joined: 31-August 11

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 02:44 PM

View PostCTphpnwb, on 14 October 2012 - 02:41 PM, said:

And what other errors did the validator point out?


Okay here's what's funny. I did some monkeying around and for some reason except for chrome the other browsers (for whatever reason) don't want to use the post value from an image button that when clicked uses the event. If I use something like

<form action="ClickDelete.php" method="post" name="CommentDelete" />
<input type="hidden" name="DelComment" value="61"  />
<input type="image" name="Submit" value="Del" src="/images/delete.png" title="Remove Your Comment" onclick="return confirm('Delete Comment?') " />
</form>



Notice it's using the hidden value it works fine!!! but if the value of 61 was assigned to an image it wouldn't work at all. I might just go this route since it works but what the heck?
Was This Post Helpful? 0
  • +
  • -

#13 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3525
  • View blog
  • Posts: 10,171
  • Joined: 08-June 10

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 14 October 2012 - 11:10 PM

View Postadn258, on 14 October 2012 - 11:44 PM, said:

but if the value of 61 was assigned to an image it wouldn't work at all.

why should an image work in the first place? images neither have a value attribute, nor are they form elements.
Was This Post Helpful? 0
  • +
  • -

#14 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3718
  • View blog
  • Posts: 5,986
  • Joined: 08-June 10

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 15 October 2012 - 01:00 AM

View Postadn258, on 14 October 2012 - 09:18 PM, said:

I still don't get it you want me to remove the / from it? so it's like > instead of /> because I tried that?

Yes, you should remove it. There is really no reason to use self-closing elements in HTML, whether you are using them "correctly" (according to XML rules at least) or incorrectly like you are using them.

This is the correct way to define a form.
<form action="?" method="whatever">
    <!-- Input elements go here -->
</form>


Adding a "/" to the end of the opening <form> element, no matter how tolerant the browsers may be towards such things, is incorrect. Even if you are choosing to go by XML rules when it comes to self-closing elements, which requires you to put a "/" to the end of elements that have no contents and no closing element, this is not one of those elements. Adding the "/" at the end of the <form> element in a true XHTML document wouldn't just be incorrect, it would cause a parse error.
Was This Post Helpful? 1
  • +
  • -

#15 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3525
  • View blog
  • Posts: 10,171
  • Joined: 08-June 10

Re: Post Data Not Posting In IE And Firefox, Why?

Posted 15 October 2012 - 01:10 AM

View PostAtli, on 15 October 2012 - 10:00 AM, said:

Adding the "/" at the end of the <form> element in a true XHTML document wouldn't just be incorrect, it would cause a parse error.

the closing </form> tag (without the corresponding opening tag, since that was auto-closed) would cause the error.
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2