473,243 Members | 1,750 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,243 software developers and data experts.

multiple image submit button problems

I currently have two image submit buttons. The code generated looks like
so:

<input type="image" src="button_in_cart.gif" border="0" alt="Add"
title="Add" name="btn_cart" value="buy">
<input type="image" src="modify.gif" border="0" alt="modify"
title="modify" name="btn_modify" value="modify">

In mozilla everything works great, but in Konqueror and MSIE the if
statement I'm using to detect which button was press does not work.

if (isset($HTTP_POST_VARS['btn_cart'])){ do stuff }

Does anyone know how to fix this without resorting to javascript?
thanx
-ryan
Jul 17 '05 #1
9 11474
*** Ryan wrote/escribió (Fri, 23 Jan 2004 04:41:53 -0800):
In mozilla everything works great, but in Konqueror and MSIE the if
statement I'm using to detect which button was press does not work.


This could be a good start:

<pre><?
print_r($_POST);
?>/pre>

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #2
Hi Ryan
<input type="image" src="button_in_cart.gif" border="0" alt="Add"
title="Add" name="btn_cart" value="buy">
<input type="image" src="modify.gif" border="0" alt="modify"
title="modify" name="btn_modify" value="modify">

In mozilla everything works great, but in Konqueror and MSIE the if
statement I'm using to detect which button was press does not work.

if (isset($HTTP_POST_VARS['btn_cart'])){ do stuff }

Does anyone know how to fix this without resorting to javascript?


Where are you checking 'btn_modify'? The line above only checks
'btn_cart'

My preferred method would be:-

<input type="image" src="button_in_cart.gif" border="0" alt="Add"
title="Add" name="action" value="buy">
<input type="image" src="modify.gif" border="0" alt="modify"
title="modify" name="action" value="modify">
if ($action == "buy") {

// do buy bit here

}
elseif ($action == "modify") {

// do modify bit here

}
--
Colin

3A Web Hosting Team
http://www.3awebhosting.co.uk
Jul 17 '05 #3
Wouldn't it make more sense to use the same name for both buttons?

<input type="image" src="button_in_cart.gif" border="0" alt="Add"
title="Add" name="btn_action" value="buy">
<input type="image" src="modify.gif" border="0" alt="modify"
title="modify" name="btn_action" value="modify">

if($_POST['btn_action'] == 'buy') ...

else if($_POST['btn_action'] == 'modify') ...

Uzytkownik "Ryan" <rc******@nospammerz.ucdavis.edu> napisal w wiadomosci
news:pa****************************@nospammerz.ucd avis.edu...
I currently have two image submit buttons. The code generated looks like
so:

<input type="image" src="button_in_cart.gif" border="0" alt="Add"
title="Add" name="btn_cart" value="buy">
<input type="image" src="modify.gif" border="0" alt="modify"
title="modify" name="btn_modify" value="modify">

In mozilla everything works great, but in Konqueror and MSIE the if
statement I'm using to detect which button was press does not work.

if (isset($HTTP_POST_VARS['btn_cart'])){ do stuff }

Does anyone know how to fix this without resorting to javascript?
thanx
-ryan

Jul 17 '05 #4
On Fri, 23 Jan 2004 16:26:29 +0000, Sales at 3A Web Hosting wrote:
Hi Ryan
<input type="image" src="button_in_cart.gif" border="0" alt="Add"
title="Add" name="btn_cart" value="buy">
<input type="image" src="modify.gif" border="0" alt="modify"
title="modify" name="btn_modify" value="modify">

In mozilla everything works great, but in Konqueror and MSIE the if
statement I'm using to detect which button was press does not work.

if (isset($HTTP_POST_VARS['btn_cart'])){ do stuff }

Does anyone know how to fix this without resorting to javascript?


Where are you checking 'btn_modify'? The line above only checks
'btn_cart'

My preferred method would be:-

<input type="image" src="button_in_cart.gif" border="0" alt="Add"
title="Add" name="action" value="buy">
<input type="image" src="modify.gif" border="0" alt="modify"
title="modify" name="action" value="modify">
if ($action == "buy") {

// do buy bit here

}
elseif ($action == "modify") {

// do modify bit here

}

Tried that, works fine in Mozilla but in Konqueror and Explorer it still
does not work.
Perhaps there is some bad html elsewhere that is messing things up. I'll
look for those errors when I get a chance.
-ryan

Jul 17 '05 #5
Sometimes the posted data does not have the value content of submit
button.
For example if the focus is in Inputbox and you press "enter" key. In
this case the first submit button will have focus.

So whatever you write in name, you need check the second submit button
in your if condition.

eg:

if(!empty($_POST))
{
// Form Posted

if(isset($_POST['second_button_name']))
/*
You can code this way if name is same for both button
if(isset($_POST['button_name'])
&& $_POST['button_name'] == "second_button_value")
*/
{
// Second button clicked

}
else
{
// First button clicked

}
}

--
Cheers,
Rahul Anand
"Ryan" <rc******@nospammerz.ucdavis.edu> wrote in message news:<pa****************************@nospammerz.uc davis.edu>...
I currently have two image submit buttons. The code generated looks like
so:

<input type="image" src="button_in_cart.gif" border="0" alt="Add"
title="Add" name="btn_cart" value="buy">
<input type="image" src="modify.gif" border="0" alt="modify"
title="modify" name="btn_modify" value="modify">

In mozilla everything works great, but in Konqueror and MSIE the if
statement I'm using to detect which button was press does not work.

if (isset($HTTP_POST_VARS['btn_cart'])){ do stuff }

Does anyone know how to fix this without resorting to javascript?
thanx
-ryan

Jul 17 '05 #6
Hi Ryan
Tried that, works fine in Mozilla but in Konqueror and Explorer it still
does not work.
Perhaps there is some bad html elsewhere that is messing things up. I'll
look for those errors when I get a chance.


Strange, it works fine here using Nutscrape, IE, Opera & kmeleon.
Have you tried an 'echo $action;' before the 'if' to make sur you are
picking up the variable?

Maybe add

if (!$action) {echo "NO VARIABLE PASSED";}

elseif ($action etc....

--
Colin

3A Web Hosting Team
http://www.3awebhosting.co.uk
Jul 17 '05 #7
On Sat, 24 Jan 2004 13:59:42 +0000, 3A Web Hosting wrote:
Hi Ryan
Tried that, works fine in Mozilla but in Konqueror and Explorer it still
does not work.
Perhaps there is some bad html elsewhere that is messing things up. I'll
look for those errors when I get a chance.


Strange, it works fine here using Nutscrape, IE, Opera & kmeleon.
Have you tried an 'echo $action;' before the 'if' to make sur you are
picking up the variable?

Maybe add

if (!$action) {echo "NO VARIABLE PASSED";}

elseif ($action etc....

I don't get it, the image button isn't getting passed into the form post
data. It isn't set, it isn't showing up at all, only works in mozilla.
Anyone offlist want to have a go at the html I'm generating?

-ryan
Jul 17 '05 #8
Hi Ryan

I don't get it, the image button isn't getting passed into the form post
data. It isn't set, it isn't showing up at all, only works in mozilla.
Anyone offlist want to have a go at the html I'm generating?


Email me a copy of your script and I'll have a look at it for you.

--
Colin

3A Web Hosting Team
http://www.3awebhosting.co.uk
Jul 17 '05 #9
The submit button works, but in IE, the value attribute is ignored
Jun 30 '06 #10

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

Similar topics

5
by: Matt | last post by:
How can I implement multiple buttons for a form like - submit, cancel, logout etc. Thanks. Matt
7
by: b2b2u | last post by:
I can't seem to get a form to submit using an image !? <input type="image" src="submit.gif"> Any body have this problem? Is it choking on the x/y coordinates? If so, what can be done about it?...
3
by: Adam | last post by:
Hey guys, I've decided to stop banging my head against the wall and just ask you guys for the answer. I can't seem to find it. I have a form in which I have multiple submit buttons; only, I'm...
3
by: D. Shane Fowlkes | last post by:
Sorry for the length of this post. I have created a rather complex form which has a header/line item (parent and child records) structure. It's for an intranet. A screenshot can be seen here: ...
5
by: Lau Lei Cheong | last post by:
Hello, Let's say that I have multiple submit buttons on a form (imagebuttons actually, but documentations say that <input type=image> which a called image buttons should behave like submit...
5
by: mayur_hirpara | last post by:
Hi, I have been developing web applications for a while now. However, as I was thinking through the architecture I really don't understand the "How server can identify between which buttons has...
0
by: David | last post by:
Hello all. I am trying to implement my first server control and have run into two problems that I cannot solve. I need the assistance of someone with more experience. My goal was to create an...
2
by: russiandevil | last post by:
hi, Does anyone have an idea on how I'd go about highlighting (with a border, or something equally effective) a input button of type 'image' (i.e. <input type=image alt=Login src=http://<etc,...
4
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all I have the following code: I am trying to use the value of the image button to evaluate what plan the user has chosen, i.e. it request("submit1")="Basic", then the user chose basic plan...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.