Re: Problem with 2 buttons

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



maybe you could do it like this:
change the name attribute of the buttons to something else (or leave them out all together)... add and onclick event and some javascript to set the values of the hidden fields...

something like this (simplified):

[CODE]
<script language='JavaScript'><!--
    function setChange(form) {
        form.change.value = true;
    }
//--></script>

<form name='theForm'>
    <input type='hidden' name='change' />
    <input type='image' name='some_name' onclick='setChange(document.theForm)' />
</form>
[/CODE]

Then you will have to have the form submitted somehow too... You could use an additional submit button or you could use a location.href in the javascript above with a hand written query string... or something...

btw... try reading up on the xhtml standard. It'll do you good (and it'll do others replaying to this thread good too... ;) )


cya

.bobo
  ----- Original Message ----- 
  From: William Cheung 
  To: php-windows@lists.php.net 
  Sent: Monday, September 22, 2003 7:43 PM
  Subject:  Problem with 2 buttons


  I have 2 buttons sitting next to each other. One to update; the other to cancel. However, no matter which button I click, the isset($_POST["CHANGE"]) always returns true. My template code is list below. Could someone tell me what's wrong with my code?



  <tr height=60>

         <td width="5%">&nbsp;</td>

         <td valign=bottom>

                     <input type="hidden" name="CHANGE">

                     <input type=image name=CHANGE src={#img_dir#}{#template#}page6grid_g3.gif onmouseover="this.src='{#img_dir#}{#template#}page6grid_g4.gif'" onmouseout="this.src='{#img_dir#}{#template#}page6grid_g3.gif'">

                     <font class=mpanel_mid_data style="font-weight: lighter;">Update order</font>

         </td>

         <td valign=bottom>

                     <input type="hidden" name="CANCEL">

                     <input type=image name="CANCEL" src={#img_dir#}{#template#}page6grid_g11.gif onmouseover="this.src='{#img_dir#}{#template#}page6grid_g12.gif'" onmouseout="this.src='{#img_dir#}{#template#}page6grid_g11.gif'">

                     <font class=mpanel_mid_data style="font-weight: lighter; text-indent: 0px;">Cancel order</font>

         </td>

  </tr>



  William Cheung B.Sc, MCSE, MCDBA

  Databyte Corp. 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux