Ryflex Posted September 28, 2011 Share Posted September 28, 2011 Hi all, I'm trying to make a form with several submit buttons. Instead of the boring one's I want to use small images. After searching on google etc. I found the following <INPUT TYPE="IMAGE" SRC="images/oce.gif" ALT="Submit" NAME="submit" ID="OCE" VALUE="OCE" WIDTH="48"; HEIGHT="48";></INPUT> Somehow nothing hapens when I use the button. When I use a GET method it gives me in return some coordinates. I need to use the POST value but is doesn't work. Full form: <FORM ID="Invoer" NAME="Invoer" METHOD="post" ACTION="/index.php"> <INPUT TYPE="IMAGE" SRC="images/oce.gif" ALT="Submit" NAME="submit" ID="OCE" VALUE="OCE" WIDTH="48"; HEIGHT="48";></INPUT> <INPUT TYPE="SUBMIT" NAME="OCEoverdracht" ID="OCEoverdracht" VALUE="OCE overdracht"></INPUT> <BR> <INPUT TYPE="SUBMIT" NAME="2e" ID="2e" VALUE="2e Kamer"></INPUT> <INPUT TYPE="SUBMIT" NAME="Oldelft" ID="Oldelft" VALUE="Oldelft"></INPUT> <INPUT TYPE="SUBMIT" NAME="Winvision" ID="Winvision" VALUE="Winvision"></INPUT> <INPUT TYPE="SUBMIT" NAME="Cargonaut" ID="Cargonaut" VALUE="Cargonaut"></INPUT> </FORM> Can anyone help me. Gr Ryflex Link to comment https://forums.phpfreaks.com/topic/248019-image-submit-button/ Share on other sites More sharing options...
AyKay47 Posted September 28, 2011 Share Posted September 28, 2011 with an image input type.. you will want to check the x and y coordinates to check if the button has been clicked.. $_POST['submit_x']; $_POST['submit_y'] can we also see the PHP code that handles your form Link to comment https://forums.phpfreaks.com/topic/248019-image-submit-button/#findComment-1273482 Share on other sites More sharing options...
Ryflex Posted September 28, 2011 Author Share Posted September 28, 2011 Thanks for the quick response. I normally used if($_POST['OCE']) { header("Location: /standby/oce.php"); } for handling but didn't know how to check with the coordinates. How do I know which coordinates to check for because the are diferent each time. Gr Ryflex Link to comment https://forums.phpfreaks.com/topic/248019-image-submit-button/#findComment-1273484 Share on other sites More sharing options...
AyKay47 Posted September 28, 2011 Share Posted September 28, 2011 the name of your image input is "submit" not "OCE", so you must use $_POST['submit'] not $_POST['OCE'] to check for the click event on the image.. you will want something like this.. if(isset($_POST['submit_x']) || isset($_POST['submit_x'])) { } Link to comment https://forums.phpfreaks.com/topic/248019-image-submit-button/#findComment-1273486 Share on other sites More sharing options...
Ryflex Posted September 28, 2011 Author Share Posted September 28, 2011 Thanks it worked. Changed the name of the input button to OCE and in de isset too. Perfect thanks again Link to comment https://forums.phpfreaks.com/topic/248019-image-submit-button/#findComment-1273488 Share on other sites More sharing options...
AyKay47 Posted September 28, 2011 Share Posted September 28, 2011 edit to the code above, just realized that I have two x coordinates by mistake in the isset() statement.. should be if(isset($_POST['submit_x']) || isset($_POST['submit_y'])) { } Link to comment https://forums.phpfreaks.com/topic/248019-image-submit-button/#findComment-1273494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.