Jump to content

Using an image to submit a form (method=GET)


JonW

Recommended Posts

<form name="<? echo "$a" ?>" action="vanpics.php" method="get">
<input type="hidden" name="van" value="<? echo "$a" ?>">
<input type="hidden" name="model" value="econoline">
<br>
<input src="<? echo "$filepath/$filename" ?>" type="image">
</form>

 

So this works fine and all, making the image act as the submit button for an invisible form, etc.

 

Only problem is that the URL it sends to ends up like this:

 

vanpics.php?van=0&model=econoline&x=113&y=96

 

It sends the coordinates that you clicked on the image, which is kind of ugly to see in the URL.

 

Is there any way to remove that?

If this script is doing any queries you'll probably want to move it to $_POST, in addition it will look even prettier.

 

Othewise I suppose you could use a javascript onClick in a standard image tag to submit the form.

 

<img src='path/to/file.ext' onClick="document.myform.submit();">

 

where myForm = the name param from the <form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.