Jump to content


Firefox/IE Submit Button Different $_POST

  • Please log in to reply
2 replies to this topic

#1 peterclutton

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 20 April 2006 - 01:16 AM

Hi all, i'd really appreciate any insight or workaround for this.

I have a form that displays a number of records, and at the bottom gives you buttons with various options, eg. Insert, Edit, Delete. These are basically in the form of:

<button type=submit name=insert>Insert</button>

I then have coe that checks the $_POST variable and acts accordingly. In Firefox, it works fine, and when I output print_r($_POST) after clicking Insert, it shows me Array(insert => insert) etc as you would expect.

However in IE when i click one of these buttons, it sets ALL the values. When i display post it shows insert => insert delete => delete and so on. Thus each seperate section of code i have all gets called.

Am i doing this the wrong way? Is there an easy fix, or should i change the approach entirely? Many Thanks in advance!

#2 poirot

  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 20 April 2006 - 01:24 AM

You can, instead of using several submit buttons, a radio group like this:

<input type="radio" name="action" value="del"> Delete
<input type="radio" name="action" value="add"> Insert
<input type="radio" name="action" value="edt"> Edit
So you just check $_GET['action'] or $_POST['action'] and it's done.

If you want to use buttons, you can create a hidden field and use javascript to set it and submit the form:

function del()
   act = document.getElementById('act');
   act.value = 'Delete';


<input type="button" value="Delete" onclick="del();">
<input type="hidden" name="action" id="act">

~ D Kuang

#3 peterclutton

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 20 April 2006 - 01:30 AM

OK, thanks for that! legend!

Seems like the Firefox way makes the most sense to me. But anyway I'll consider my options out of those two.

Thanks again for the quick reply.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users