Page 1 of 1

Submit does not work in IE and Opera on form POST

Posted: Mon Apr 12, 2004 9:39 pm
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?

Posted: Tue Apr 13, 2004 8:35 am
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.

Posted: Tue Apr 13, 2004 8:37 pm
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"

Posted: Tue Apr 13, 2004 9:19 pm
by d3ad1ysp0rk
pass a hidden variable with the form instead of submit.

Posted: Tue Apr 13, 2004 9:32 pm
by markl999
Not sure if that was a typo above, but ...
action="..<?php echo $_SERVER['PHP_SELF']; ?>"

Why the ..'s ?