|
|
|
| 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 : |
4 of 5 (graded 1 times) |
| Viewed : |
4496 |
| 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 | | | A simple class with some HTML output functions that would come in handy for consistent page layout etc. Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation | | | The following snippet gives complete info about all submitted
HTTP_POST_VARS and HTTP_GET_VARS Categories : Variables, HTTP, PHP | | | clearing variables in php3 Categories : Variables, Arrays, PHP | | | Parses HTTP_USER_AGENT so that you can customize your site to different browsers Categories : HTML, PHP, Complete Programs | | | How to display a PHP variable value from a selectbox without reloading the
page by merging PHP and Javascript variables. Categories : PHP, Java Script, Variables | | | FormWizard reads a mysql table and generates automatically
a html formular in a html-table Categories : PHP, MySQL, HTML | | | Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form Categories : HTML, PHP, Strings | | | Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP, Directories, Variables, Arrays | | | translate.php - Assocciative array example, passing a reference to a function. Categories : PHP, Arrays, Languages, Variables | | | 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 | | | BBCode Formatting String Categories : PHP, HTML, Regexps, Arrays | | | getting the name of the current script and query string Categories : PHP, Global Variables, Variables, URLs | | | Display Slashdot headers on your own site Categories : HTML and PHP, HTML, PHP | |
|
|
|