Simple submit/imagefield question

Sainkho
Sainkho used Ask the Experts™
on
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?
Comment
Watch Question

Do more with

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

Commented:
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

Author

Commented:
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.
Commented:
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.

Paul

Author

Commented:
Thar she blows!

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

Commented:
FYI:

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.

Paul

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