Re: Image Submits to Forms

From: Date: Sat, 05 Mar 2005 01:02:27 +0000
Subject: Re: Image Submits to Forms
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210056@lists.php.net to get a copy of this message
Marquez Design wrote:
Greetings, I am trying to create a form that will do the following: First, select a page from a select box, Second, click on a button on the side that will do a specific function. Select page, then with the delete button, delete the file, Select page, then with the edit button, edit the page. Does anyone know how I could do this?
HTML of the buttons: <input type="image" src="delete.gif" name="delete"> <input type="image" src="edit.gif" name="edit"> Then in the form handling script: if(isset($_POST['delete_x']) && isset($_POST['delete_y']) { // delete } if(isset($_POST['edit_x']) && isset($_POST['edit_y']) { // edit } If every browser was standards compliant, you could use: <input type="image" src="delete.gif" name="action" value="delete"> <input type="image" src="edit.gif" name="action" value="edit"> switch($_POST['action']) { case 'delete': // delete break; case 'edit': // edit break; }

« previous php.general (#210056) next »