473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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">Add 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|addnews') 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($key)) {
case 'addnews_x':
PostHandler('addnews', 'news', '/posteditor.php');
break;
case 'editnews_x':
PostHandler('editnews', 'news', '/postsearch.php');
break;
case 'deletenews_x':
PostHandler('deletenews', 'news', '/postsearch.php');
break;
...

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

ob_end_clean();
header('Location: 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 7888
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">Add 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|addnews') 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($key)) {
case 'addnews_x':
PostHandler('addnews', 'news', '/posteditor.php');
break;
case 'editnews_x':
PostHandler('editnews', 'news', '/postsearch.php');
break;
case 'deletenews_x':
PostHandler('deletenews', 'news', '/postsearch.php');
break;
...

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

ob_end_clean();
header('Location: 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*********@internode.on.netwrote in message
news:pa****************************@internode.on.n et...
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">Add 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|addnews') 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***@bhgbyrzcv.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*********@internode.on.netsaid:
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">Add 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|addnews') 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($key)) {
case 'addnews_x':
PostHandler('addnews', 'news', '/posteditor.php');
break;
case 'editnews_x':
PostHandler('editnews', 'news', '/postsearch.php');
break;
case 'deletenews_x':
PostHandler('deletenews', 'news', '/postsearch.php');
break;
...

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

ob_end_clean();
header('Location: 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
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...
1
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...
1
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: ...
2
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...
17
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...
2
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
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...
3
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.