Form>input>image 'value' not sent in IE

Discuss general web development questions. Help others and get help from others.

Moderator: kfury77

Form>input>image 'value' not sent in IE

Postby andymat » Thu Jul 24, 2008 1:21 pm

I am using PHP to write the graphical output of a shopping basket and have multiple submit buttons (using <input type="image" value="...>) to increase/reduce the entry or remove it altogether. I would have liked to use the value attribute set to the number of the record in the basket to determine from which entry in the basket the submit has been sent so that I can deal solely with that entry. However, IE does not send this data, only the X & Y co-ordinates of the click, although Firefox does.

The solutions I have though of so far are:

- Use a different form for each record but this makes it difficult to use a table to line up all the items and their prices in columns.
- Have the name of each record's button appended with the number of the record. Loop around the records to detect which name has has a co-ordinate sent to it and extract the number from the name.

Has anyone else had to solve this problem? Any thoughts?

Andy
andymat
 
Posts: 12
Joined: Tue May 06, 2008 9:55 pm
Location: Darlington, UK

Re: Form>input>image 'value' not sent in IE

Postby syrupcore » Sat Jul 26, 2008 7:03 pm

I'd like to help but I'm not sure I understand the question. Can you send a url?

would <input type="hidden" value="here" name="thisItemID"/> help?
User avatar
syrupcore
Top Contributor
 
Posts: 917
Joined: Thu Jul 21, 2005 12:58 am
Location: Portland, Oregon, usa

Re: Form>input>image 'value' not sent in IE

Postby andymat » Wed Aug 06, 2008 3:00 pm

Thanks Mr Syrupcore, but I don't think that would help.

I'm afraid I am new to PHP and am still coming to grips with its capabilities.

I'll try and explain, although I have now got round these problems now in a different way.

I have a shopping basket which could have several items in it, each item being a row on the web page. Qty (changeable in <input type="text" ... />, item name, unit cost, total cost and then a button to remove this item.
I wanted to have 1 form for, possibly, many rows, each row having a remove button with submit functionality. This was because the form submitted to itself using POST when an update was required. I wanted to use <input type="image"... /> in the form for the buttons and be able to tell when the page was being created by php, which row the button that had been pressed was from.

However, I found that IE (probably functioning the way it should) would not submit an identifier (value="this is on line 1"... />) with it's info, just co-ords of where it was clicked on, even though Firefox did.

It's all part of my learning curve, and thanks for your willingness to help.

I have got round this now by getting php to add an identifier at the end of a standard anchor link when it creates the page. So I am now not actually using a form at all for this part of the basket.

You can see the result here, although you will need to add something to the basket to see it working obviously-
http://www.reddogracing.co.uk/basket.php
andymat
 
Posts: 12
Joined: Tue May 06, 2008 9:55 pm
Location: Darlington, UK

Re: Form>input>image 'value' not sent in IE

Postby SilverHand » Wed Sep 24, 2008 12:02 pm

Hi Andy, it is not so hard and it is not the problem of IE.
Check this adress i prepared for u: http://www.cimax.cz/forums/helpform.php

As u can see u must use NAME in <input type="image"> TAG and in PHP u get two new $_POST variables. The names of this variable are made from image NAME and '_x' or '_y'. So only make some code to check all POST variables with the NAME of image in it and u get what u need.

Situation:
as NAME of image use for example IMDISCARD_1 ...2 ...3 etc.
and in PHP u get $_POST variables IMDISCARD_1_x, IMDISCARD_1_y ...etc
after POST use for(....) to check all $_POST variables which names contain IMDISCARD on begining and then get the number between those '_' in its
name and u get your BASKET row ID.

Cya Silver

P.S. I really do not like pages with disabled right click :)
Cya Silver

Every problem has its solution! But sometimes we can't find it!
PC info: Core 2 Extreme 3Ghz, 8Gb DDR 3, System HDD: RAID 0 - 2x raptor 150, Vista Ultimate 64bit
User avatar
SilverHand
 
Posts: 9
Joined: Thu May 29, 2008 10:13 am

Re: Form>input>image 'value' not sent in IE

Postby andymat » Wed Oct 15, 2008 12:59 am

Well thank you. I thought there must be a way of solving it.

Thanks for the example too - it illustrates the solution very well.

Andy
andymat
 
Posts: 12
Joined: Tue May 06, 2008 9:55 pm
Location: Darlington, UK


Return to Web Developer Talk

Who is online

Users browsing this forum: No registered users and 1 guest

cron