How to detect which button on input form pressed?

2012-02-13 Thread McScreech
PHP 5.3.3, CakePHP 2.0.6 echo $this-Form-submit('Submit', array('div'=false, 'name'='Submit' )); echo $this-Form-submit('Cancel', array('div'=false, 'name'='Cancel' )); If I code multiple buttons on my form as above, how do I detect when the Cancel button is pressed? McS -- Our newest site

Re: How to detect which button on input form pressed?

2012-02-13 Thread Tilen Majerle
if (isset($this-request-data['Submit'])) {} or if (isset($this-request-data['Cancel'])) {} -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/2/13 McScreech scre...@sympatico.ca PHP 5.3.3, CakePHP 2.0.6 echo $this-Form-submit('Submit', array('div'=false, 'name'='Submit' )); echo

Re: How to detect which button on input form pressed?

2012-02-13 Thread thatsgreat2345
I understand why there might be applications in which you want to know what data was in the form when the user clicked cancel, but if you're canceling why are you submitting the form? Why not just link them back to the index or wherever they came from. On Feb 13, 12:02 pm, McScreech

Re: How to detect which button on input form pressed?

2012-02-13 Thread McScreech
Thank you, that did it. McS On Feb 13, 3:05 pm, Tilen Majerle tilen.maje...@gmail.com wrote: if (isset($this-request-data['Submit'])) {} or if (isset($this-request-data['Cancel'])) {} -- Lep pozdrav, Tilen Majerlehttp://majerle.eu 2012/2/13 McScreech scre...@sympatico.ca PHP

Re: How to detect which button on input form pressed?

2012-02-13 Thread McScreech
That's exactly what I am doing. If they click Cancel I redirect back to the referring page. McS On Feb 13, 4:34 pm, thatsgreat2345 thatsgreat2...@gmail.com wrote: I understand why there might be applications in which you want to know what data was in the form when the user clicked cancel, but