You are here: input type="image" $_POST queries « PHP Programming Language « IT news, forums, messages
input type="image" $_POST queries

Posted by Mark Woodward on 12/17/33 11:52

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация