473,699 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

input type="image" $_POST queries

Hi all,

I'm trying to set up a 'control panel' consisting of a table of icons.

The early stages: http://www.deepinit.com/controlcentre.php

Each of these is set up like:

<td>
<input type="image" id="addnews" src="/Image/add24.png"
name="addnews" value="addnews" width="24" height="24"><br />
<label for="addnews">A dd News Item</label><br />
</td>

This is all taking place in a html form and I'm using input
type="image"... like 'submit' buttons.

Is this a 'good' approach?

I'm trying to handle the $_POST variable after a user clicks on one of
these but there are differences between firefox and ie6.

Using:
foreach ($_POST as $key=>$val) {
echo $key ."|". $val . "<br />";
}

ie6 is only listing
addnews_x|8
addnews_y|17
Firefox:
addnews_x|10
addnews_y|13
addnews|addnews

Why am I getting x and y co-ordinates?

Why in firefox do I get $val ('addnews|addne ws') but not in ie6?

What I'm trying to do is redirect to other pages based on $_POST:

foreach ($_POST as $key=>$val) {
switch (strtolower($ke y)) {
case 'addnews_x':
PostHandler('ad dnews', 'news', '/posteditor.php' );
break;
case 'editnews_x':
PostHandler('ed itnews', 'news', '/postsearch.php' );
break;
case 'deletenews_x':
PostHandler('de letenews', 'news', '/postsearch.php' );
break;
...

function PostHandler($co mmand, $post_type, $redir_page) {
$_SESSION['ctlcentcmd'] = $command;
$_SESSION['posttype'] = $post_type;

ob_end_clean();
header('Locatio n: http://' . $_SERVER['HTTP_HOST']
. $redir_page);
}
This is working but I'm not happy basing this on the x co-ordinate
(eg addnews_x). Surely there must be a better way?

If you wanted to implement a similar icon based 'Control Centre' what
approach would you take? The intent is to have a single page where the
site admin can add/edit/delete news, articles, bios, user data, etc
thanks for your help,

--
Mark

Jul 10 '06 #1
5 7914
Since your using an image in an input field then that information is
being submitted by post to (the image is). Thats fine, just access each
post variable indivually (yes it takes a bit longer but as you have
seen IE and FF differ)

so just get your vars as so: $submitedname = $_POST['name'];

Flamer.

Mark Woodward wrote:
Hi all,

I'm trying to set up a 'control panel' consisting of a table of icons.

The early stages: http://www.deepinit.com/controlcentre.php

Each of these is set up like:

<td>
<input type="image" id="addnews" src="/Image/add24.png"
name="addnews" value="addnews" width="24" height="24"><br />
<label for="addnews">A dd News Item</label><br />
</td>

This is all taking place in a html form and I'm using input
type="image"... like 'submit' buttons.

Is this a 'good' approach?

I'm trying to handle the $_POST variable after a user clicks on one of
these but there are differences between firefox and ie6.

Using:
foreach ($_POST as $key=>$val) {
echo $key ."|". $val . "<br />";
}

ie6 is only listing
addnews_x|8
addnews_y|17
Firefox:
addnews_x|10
addnews_y|13
addnews|addnews

Why am I getting x and y co-ordinates?

Why in firefox do I get $val ('addnews|addne ws') but not in ie6?

What I'm trying to do is redirect to other pages based on $_POST:

foreach ($_POST as $key=>$val) {
switch (strtolower($ke y)) {
case 'addnews_x':
PostHandler('ad dnews', 'news', '/posteditor.php' );
break;
case 'editnews_x':
PostHandler('ed itnews', 'news', '/postsearch.php' );
break;
case 'deletenews_x':
PostHandler('de letenews', 'news', '/postsearch.php' );
break;
...

function PostHandler($co mmand, $post_type, $redir_page) {
$_SESSION['ctlcentcmd'] = $command;
$_SESSION['posttype'] = $post_type;

ob_end_clean();
header('Locatio n: http://' . $_SERVER['HTTP_HOST']
. $redir_page);
}
This is working but I'm not happy basing this on the x co-ordinate
(eg addnews_x). Surely there must be a better way?

If you wanted to implement a similar icon based 'Control Centre' what
approach would you take? The intent is to have a single page where the
site admin can add/edit/delete news, articles, bios, user data, etc
thanks for your help,

--
Mark
Jul 10 '06 #2
"Mark Woodward" <ma*********@in ternode.on.netw rote in message
news:pa******** *************** *****@internode .on.net...
Hi all,

I'm trying to set up a 'control panel' consisting of a table of icons.

The early stages: http://www.deepinit.com/controlcentre.php

Each of these is set up like:

<td>
<input type="image" id="addnews" src="/Image/add24.png"
name="addnews" value="addnews" width="24" height="24"><br />
<label for="addnews">A dd News Item</label><br />
</td>

This is all taking place in a html form and I'm using input
type="image"... like 'submit' buttons.

Is this a 'good' approach?

I'm trying to handle the $_POST variable after a user clicks on one of
these but there are differences between firefox and ie6.

Using:
foreach ($_POST as $key=>$val) {
echo $key ."|". $val . "<br />";
}

ie6 is only listing
addnews_x|8
addnews_y|17
Firefox:
addnews_x|10
addnews_y|13
addnews|addnews

Why am I getting x and y co-ordinates?

Why in firefox do I get $val ('addnews|addne ws') but not in ie6?
"Creates a graphical submit button. The value of the src attribute specifies
the URI of the image that will decorate the button. For accessibility
reasons, authors should provide alternate text for the image via the alt
attribute.

When a pointing device is used to click on the image, the form is submitted
and the click coordinates passed to the server. The x value is measured in
pixels from the left of the image, and the y value in pixels from the top of
the image. The submitted data includes name.x=x-value and name.y=y-value
where "name" is the value of the name attribute, and x-value and y-value are
the x and y coordinate values, respectively." From:
http://www.w3.org/TR/REC-html40/inte....html#h-17.4.1

Note that php will convert name.x to name_x and name_y since period is
invalid in variable name.

What I'd like to know is what happens in IE if images are disabled or
non-existing image uri is given, and form is submitted by clicking the image
input which is converted to normal submit button, is the actual name then
provided? Are the coordinates (0,0) provided?

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi. net | Gedoon-S @ IRCnet | rot13(xv***@bhg byrzcv.arg)
Jul 11 '06 #3
Thanks guys,

On Tue, 11 Jul 2006 12:59:10 +0300, Kimmo Laine wrote:
"Creates a graphical submit button. The value of the src attribute specifies
the URI of the image that will decorate the button. For accessibility
reasons, authors should provide alternate text for the image via the alt
attribute.

When a pointing device is used to click on the image, the form is submitted
and the click coordinates passed to the server. The x value is measured in
pixels from the left of the image, and the y value in pixels from the top of
the image. The submitted data includes name.x=x-value and name.y=y-value
where "name" is the value of the name attribute, and x-value and y-value are
the x and y coordinate values, respectively." From:
http://www.w3.org/TR/REC-html40/inte....html#h-17.4.1

Note that php will convert name.x to name_x and name_y since period is
invalid in variable name.

What I'd like to know is what happens in IE if images are disabled or
non-existing image uri is given, and form is submitted by clicking the image
input which is converted to normal submit button, is the actual name then
provided? Are the coordinates (0,0) provided?
Kimmo, I just disabled images in ie6 so I'm only see the placeholders. It
still works as though the image was there (ie getting the x and y coords).
--
Mark
Jul 11 '06 #4
Mel
On 2006-07-10 21:12:13 +1000, Mark Woodward
<ma*********@in ternode.on.nets aid:
Hi all,

I'm trying to set up a 'control panel' consisting of a table of icons.

The early stages: http://www.deepinit.com/controlcentre.php

Each of these is set up like:

<td>
<input type="image" id="addnews" src="/Image/add24.png"
name="addnews" value="addnews" width="24" height="24"><br />
<label for="addnews">A dd News Item</label><br />
</td>

This is all taking place in a html form and I'm using input
type="image"... like 'submit' buttons.
Is this a 'good' approach?

I'm trying to handle the $_POST variable after a user clicks on one of
these but there are differences between firefox and ie6.
Using:
foreach ($_POST as $key=>$val) {
echo $key ."|". $val . "<br />";
}

ie6 is only listing
addnews_x|8
addnews_y|17
Firefox:
addnews_x|10
addnews_y|13
addnews|addnews
Why am I getting x and y co-ordinates?
Why in firefox do I get $val ('addnews|addne ws') but not in ie6?

What I'm trying to do is redirect to other pages based on $_POST:

foreach ($_POST as $key=>$val) {
switch (strtolower($ke y)) {
case 'addnews_x':
PostHandler('ad dnews', 'news', '/posteditor.php' );
break;
case 'editnews_x':
PostHandler('ed itnews', 'news', '/postsearch.php' );
break;
case 'deletenews_x':
PostHandler('de letenews', 'news', '/postsearch.php' );
break;
...

function PostHandler($co mmand, $post_type, $redir_page) {
$_SESSION['ctlcentcmd'] = $command;
$_SESSION['posttype'] = $post_type;

ob_end_clean();
header('Locatio n: http://' . $_SERVER['HTTP_HOST']
. $redir_page);
}
This is working but I'm not happy basing this on the x co-ordinate
(eg addnews_x). Surely there must be a better way?

If you wanted to implement a similar icon based 'Control Centre' what
approach would you take? The intent is to have a single page where the
site admin can add/edit/delete news, articles, bios, user data, etc
thanks for your help,
I'd be inclined to make them buttons and use CSS to style them out to
be images (turn off the borders, specify a width and height, set a
background-image). From there you can either use them to sumit to a
page using AJAX, JavaScript, or a plain old form.

Jul 11 '06 #5
Hi Mel,

On Wed, 12 Jul 2006 00:05:19 +1000, Mel wrote:
I'd be inclined to make them buttons and use CSS to style them out to
be images (turn off the borders, specify a width and height, set a
background-image). From there you can either use them to sumit to a
page using AJAX, JavaScript, or a plain old form.
I'd be inclined to agree with you ;-)
Just tried this and it seems much cleaner!!

thanks,

--
Mark
Jul 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
18777
by: Jawahar Rajan | last post by:
All, I am using a few Input type of "Image" instead of a classic submit button in a form to achieve various tasks for example image1 - add user image2 - modify user image3 - delete user image4 - reSet user.
1
3045
by: Dave | last post by:
Hi all, I was trying to make an image submit button with a rollover and discovered to my suprise that there is no way to access a form element of the "image" type. I tried specifying it by name and also by the elements array with no luck. Even weirder, I can sandwich an image button in between other input types and then write a script diplaying the contents of the elements array and it acts as if the image button does not exist at all!...
1
1774
by: zelnugget | last post by:
I'm using a fading image script that I found via Google Groups on this newsgroup, and am having some difficulty with it. First, here's a link to the Google Groups posting: http://groups-beta.google.com/group/comp.lang.javascript/msg/3f287a2f20de1b10 I've modified the page linked to in the above URL by making one of the images an input element whose type is an image and am now encountering flickering problems. Here's the webpage:
2
4228
by: Mr.Clean | last post by:
If I have an Input of type image, it is not listed in the Forms elements when walking to DOM using MSHTML. Is this expected behaviour and how would I get the image input to submit the form NOT using document.form.submit?
17
3199
by: Alan Silver | last post by:
Hello, I have a page which I am converting to use themes. The page has an HTML <input type="image"> element that is used to post to another page. I would like to replace this with a server control so I can add a skinid. I tried adding runat="server" and the skinid to the existing control, but that didn't work. Any other ideas? TIA --
2
2762
by: Alan Silver | last post by:
Hello, If I have the following HTML... <input type="image" src="fred.gif"> .... is there a way to specify the image in CSS rather than in the HTML? TIA
3
2030
by: PJ6 | last post by:
Embedded javascript can be served from a DLL with an include that uses a special URL generated by the Page.ClientScript.GetWebResourceUrl method at runtime. For example: <script src="/DEV-WEB/WebResource.axd?d=Fzr7sc4IZAELIE4FCpgaNkpd1YgQqgig1EfiFj9_b7U1&t=633202779231250800"type="text/javascript"></script> .... so can style sheets: <link rel="stylesheet" type="text/css"
3
2255
by: =?Utf-8?B?V2lsbA==?= | last post by:
I have an image "button" which causes a postback. I handle the "click" with If Request.Form("btnBU7WD6_Submit.X") 0 Then... this works great. However, when a user double-clicks the image button the Page_Load (postback) is processed twice. This is a problem. Is there any easy way to detect that the image button has been double-cliked
0
8694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8621
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8928
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7757
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4634
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3060
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.