WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : How to know which input button of type image was pressed in a form with multiple image buttons (_x and _y) in PHP?
Categories : PHP, Variables, HTML
Boaz Yahav
Date : Oct 04th 1999
Grade : 5 of 5 (graded 2 times)
Viewed : 5292
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Boaz Yahav
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

PHP has an extension to the variable name which is _x and _y.

If you have a form like :

<FORM ACTION="DeleteMe.php3" NAME="MyForm" METHOD="POST">
<INPUT TYPE="image" NAME="Delete1" SRC="Yes.gif" VALUE="Yes">
<INPUT TYPE="image" NAME="Delete2" SRC="No.gif" VALUE="Yes">
</FORM>


When you press on one of the buttons in the form you get to DeleteMe.php3.
If you pressed on Delete1 you will find that you have two variables named
$Delete1_x and $Delete1_y which represent the coordinates of the button.

We can use this to know which button was pressed in two ways :


1. Check the coordinates of the button and by that know which one was pressed.

2. The second option, which i like better because you don't need to change the
code in case that you move the location of the buttons is that you simply check
if the variable is set like :

If(IsSet($Delete1_x)) Echo "Yes";
If(IsSet($Delete2_x)) Echo "no";

berber



Script to check values being submitted by POST or GET method from a form. This script may help diagnose what variables are being supplied by a browser to other php scripts.
Categories : HTML, Variables, Debugging, PHP, HTTP
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
How to preset a text string in a textarea input field
Categories : HTML, HTML and PHP, PHP, Beginner Guides
This functions compares the current PHP version with a desired version. Because of the 3 tiered version system, a direct compare of a string to phpversion() will not be accurate.
Categories : PHP Configuration, PHP, Variables
How to control the number of decimal places when outputting numbers.
Categories : PHP, Strings, Variables
How to use regular expressions to get the list of links from an HTML page
Categories : PHP, Regexps, HTML, HTML and PHP
Paginator - a class that can help you to split MySQL database query result sets to pages.
Categories : MySQL, Databases, HTML, PHP
BBCode Formatting String
Categories : PHP, HTML, Regexps, Arrays
serialize -- Generates a storable representation of a value
Categories : PHP, PHP Functions, Variables
Global Dump Highlighted
Categories : PHP, Variables, Global Variables
Browser Detecor Class
Categories : PHP Classes, PHP, HTML
How to get the source of a site into an array.
Categories : Arrays, HTML, PHP
Real simple example of removing HTML tags from text then changing \n (new line) to <br>. Could be used in a forum for instance.
Categories : HTML, PHP, HTML and PHP, Beginner Guides
Simple script to passing persistent and growing array between recalls of one page (manipulate little stack).
Categories : Arrays, Global Variables, PHP, HTML and PHP, Variables
GonxTabs : Create elegant HTML tabs based interface
Categories : Navigation, HTML, HTML and PHP, PHP