peterclutton Posted April 20, 2006 Share Posted April 20, 2006 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! Quote Link to comment https://forums.phpfreaks.com/topic/7912-firefoxie-submit-button-different-_post/ Share on other sites More sharing options...
poirot Posted April 20, 2006 Share Posted April 20, 2006 You can, instead of using several submit buttons, a radio group like this:[code]<input type="radio" name="action" value="del"> Delete<input type="radio" name="action" value="add"> Insert<input type="radio" name="action" value="edt"> Edit[/code]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:[code]function del(){ act = document.getElementById('act'); act.value = 'Delete'; document.forms[0].submit();}//////<input type="button" value="Delete" onclick="del();"><input type="hidden" name="action" id="act">[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7912-firefoxie-submit-button-different-_post/#findComment-28830 Share on other sites More sharing options...
peterclutton Posted April 20, 2006 Author Share Posted April 20, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/7912-firefoxie-submit-button-different-_post/#findComment-28833 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.