Submit does not work in IE and Opera on form POST

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rudeworx
Forum Newbie
Posts: 2
Joined: Mon Apr 12, 2004 9:39 pm

Submit does not work in IE and Opera on form POST

Post by rudeworx »

I am a newbie to PHP.

I have been trying to get a picture list going, based on contents of a directory (filesystem) javascript:emoticon('8O')(now don't tell me there is enough code out there that does this trick; this is a deliberate action to learn PHP)
javascript:emoticon('8O')

I get the code to work in Mozilla browsers. The code even validates thoroughly on the validation tools from W3C, but I just cannot get a succesfull post in IE nor in Opera. It looks as if the submission in those browsers does not post anything (except for the coordinates of the clicked input variable). Debugging the code does not help me any further either.

Below I have included my code.

Code: Select all

<?php

if (!IsSet($_POST&#1111;'Submit'])) &#123;
	$Sel_Pict="";
	&#125;
	else &#123;
	$Sel_Pict = $_POST&#1111;'Submit'];
	&#125;
?>
<body>
<table border="0" cellspacing="0" cellpadding="2" summary="pictures" width="598">
 <tr>
  <td width="500">
<?php
  $Sel_Pic = substr($Sel_Pict, 1, 7);
	if (IsSet($Sel_Pic)) &#123;
	  print("<div><img src="$PathToPics$Sel_Pic" alt="$Sel_Pic" align="top" title="$Sel_Pic" border="1" ></div>");
	&#125;
?>
<br>
<br>
<br>
	</td>
  <td>
	<table>      
	    <tr>
		    <td>
	  		  <form name="pictureForm" method="post" action="..<?php echo $_SERVER&#1111;'PHP_SELF']; ?>">
				    <?php 
							$Open=opendir("$PathToThumbs");
							While ($Files=readdir($Open)) &#123;
                if(strstr(strtolower($Files),".jpg") || strstr(strtolower($Files),".gif"))  &#123;
        			    print("<input type="image" name="Submit" onclick="document.forms&#1111;'pictureForm'].submit()" src="$PathToThumbs$Files" value="P$Files" id="P$Files"><br>");
                &#125;
            	&#125;
						?>
		      </form>
	      </td>
      </tr>
  </table>
</table>
</body>


Does anyone have suggestions?
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

Firing the submit method on a form and clicking the submit button aren't exactly the same thing. Maybe your experiencing a difference between browser types? Do you need the "onClick" event, since the default behavior for clicking an <input type=image is to submit the form?

I'd suggest taking the onclick event out and seeing if that helps.
rudeworx
Forum Newbie
Posts: 2
Joined: Mon Apr 12, 2004 9:39 pm

Post by rudeworx »

TheBentinel.com wrote:Firing the submit method on a form and clicking the submit button aren't exactly the same thing. Maybe your experiencing a difference between browser types? Do you need the "onClick" event, since the default behavior for clicking an <input type=image is to submit the form?

I'd suggest taking the onclick event out and seeing if that helps.
As far as I can ponder, I have no need for the "onClick" event. It was suggested to me by several people, so I tried it. But leaving it out does not change the behaviour in the other browsers.

I keep getting the right page in "Mozilla" and just the thumbnails in "IE" and "Opera"
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

pass a hidden variable with the form instead of submit.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Not sure if that was a typo above, but ...
action="..<?php echo $_SERVER['PHP_SELF']; ?>"

Why the ..'s ?
Post Reply