RE: multiple submit buttons

From: Date: Wed, 29 Aug 2001 12:52:21 +0000
Subject: RE: multiple submit buttons
Groups: php.general 
Request: Send a blank email to php-general+get-65009@lists.php.net to get a copy of this message
As far as any CGI is concerned there is only one submit, The one that is pressed. The other one is simply not posted. But be careful using values of submit buttons ... if the user hits return instead of clicking one of the buttons you won't get anything. If you want a default value try a hidden field before the submits with same name. Tim Ward ---------- From: Justin French [SMTP:justin@indent.com.au] Sent: 29 August 2001 08:10 To: php Subject: multiple submit buttons Hi all, I noticed this chunk of code in a site the other day: <input type="Submit" name="btn" value="Yes"> <input type="Submit" name="btn" value="No"> My GUESS is that if i click the "Yes" button, I magically get $btn = "Yes" as a var is the receieving PHP script. I was just about to test this, when I realised that (from what I can tell) multiple submits are not supported by CGI spec. So, even if it works on my browser/platform/server/php combination, can I be sure it'll work faithfully on all environments? Should I be worried about what the browser sends, or what PHP does with it, etc etc? Has anyone doen some serious testing on this? Good or bad stories? Justin French

« previous php.general (#65009) next »