Forum Moderators: open

Message Too Old, No Replies

using an image as a submit button

are there any differences between IE and Netscape?

         

Alina

3:00 pm on Nov 8, 2004 (gmt 0)

10+ Year Member



Hello

I am trying to use an image as a submit button. So my php/html code looks something like:

<? PHP code
if (isset ($submit))echo "true<br>";
else echo "false<br>";
?>

<form name="formX" method="post" action="" onSubmit="return check_form(this)">
<input name="submit" type="image" src="images-design/log-in.gif" alt="Log in button">
</form>

I was wondering if there were some important differences between Netscape and Internet Explorer in how they handle this tag? And if anyone knew how to get around this?

Also when i check if "submit" (name of image) is set after clicking the image i am getting false, when it should be true. Does anyone know why this maybe so?

Many thanks for your time

Alina

BlobFisk

8:50 am on Nov 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HI Alina,

The value passed by an image input is an unusual one, in that it is the coordinates of where the mouse click occured that is sent through in the HTTP request. The W3C say [w3.org]:


When a pointing device is used to click on the image, the form is submitted and the click coordinates passed to the server. The x value is measured in pixels from the left of the image, and the y value in pixels from the top of the image. The submitted data includes name.x=x-value and name.y=y-value where "name" is the value of the name attribute, and x-value and y-value are the x and y coordinate values, respectively.

I've seen this before and we still used an image submit button but the server side code sniffed for the presence of "px" - that may work in your case also?

HTH

Alina

10:25 am on Nov 9, 2004 (gmt 0)

10+ Year Member



Thanks for taking the time to reply. After querying for similar problems within Google and doing searches for previous queries on the WebmasterWorld forums - I finally understood this!

Many thanks again.

dcrombie

10:29 am on Nov 9, 2004 (gmt 0)



Basically, with an image submit button you get "name.x" and "name.y" which translate to PHP as $name_x and $name_y