|
|
|
| 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 : |
6265 |
| 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 |
|
|
|
|
|
|
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 |
|
| Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | 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 | | | Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | GonxTabs : Create elegant HTML tabs based interface Categories : Navigation, HTML, HTML and PHP, PHP | | | getting the name of the current script and query string Categories : PHP, Global Variables, Variables, URLs | | | clearing variables in php3 Categories : Variables, Arrays, PHP | | | Take multiple text files and do simple formatting on them and add them to a webpage Categories : HTML, Filesystem, PHP | | | Initialize global variables for every field in a table.
This version requires that phplib is installed on your
server. Categories : Global Variables, MySQL, PHP, Variables | | | class formHTML build your HTML Forms from PHP Categories : PHP, PHP Classes, HTML and PHP, HTML | | | Newbie Notes #5 - To double quote, or single quote, that is the question Categories : PHP, Beginner Guides, Variables | | | The first step Guest Book ... ^^ Categories : MySQL, PHP, Apache, HTML, HTTP | | | Automatic global variable definer Categories : PHP, Variables, Beginner Guides | | | webcam cam view image ispy browser independant Categories : Graphics, HTML, HTML and PHP, PHP | | | A widget for presenting color options in a drop down menu Categories : HTML, PHP | | | A quick way set data from a form to a function or other places where you can lose scope. Categories : PHP, HTML and PHP, Variables | |
| |
| |
|