Simple submit/imagefield question

Sainkho used Ask the Experts™
Learning from my books and all the sample scripts use a submit button and on posting check for the $submit variable.

Fine and dandy.

But what happens when you use an imagefield instead of an HTML button. What variable should I be looking for?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

the default function for a form if i am correct is to submit so have an <input type="image"...> should submit the form like a standard button.  If it needs to be something besides submit()  then you could possibly do something like:
<input type="image" onclick="submit() or whatever you need">

hope that helps


Hmmm, don't think I made myself clear. Or I am missing the point all together.

My book scripts all use an HTML submit button and when looking to see if the form has been submitted, look for !$submit. When I substitute an image for the HTML button this doesn't work.

Basically, I'm looking for someone to post the code for an image instead of the HTML button and then tell me how php detects this button has been pressed.

I think.
An image form element can only be used to submit the form, it cannot be used to reset the form.

The html for image elements is as follows:

<input type="image" name="Submit" value="Submit" src"submit.gif" width="125" height="25" border="0">

Notice the "name" parameter of the input: Submit. When the form data is returned PHP has the following:

Submit_x = 72
Submit_y = 11

The form does not return $submit as a field. Also if you name the image differently, such as "Modify" the form would return:

Modify_x = 72
Modify_y = 11

instead of Submit_x/y.



Thar she blows!

Many thanks. Why the books don't cover this I don't know.


The x/y values change depending upon the x/y coordinates of where the user clicked in the image. So 72, 11 means the user clicked the submit image at those coordinates.


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial