Page 1 of 1
php button submit
Posted: Wed Sep 27, 2006 12:40 pm
by ssettlemyre
do <button> style submits get posted with form submits? I dont think they do.
Typically I use submit forms with <input> submits then switch based on the $_POST key string to determine which button was pushed.
Code: Select all
<?
if($_POST['login']){
// do login stuff
}
?>
<input type="submit" name="login" value="login">
but i'd like to do the same with <button> type submits (can make them a lot fancier)
Posted: Wed Sep 27, 2006 12:42 pm
by Luke
is there a question in there somewhere??

Posted: Wed Sep 27, 2006 12:44 pm
by ssettlemyre
do <button> style submits get posted with form submits?
isn't that a question?
Even though I answered it myself, I was asking if anyone knows otherwise.
Posted: Wed Sep 27, 2006 12:57 pm
by onion2k
No they don't because a 'button' input element isn't a submitted form field. You can use JavaScript to update a hidden value and the submit the form on a click of a button though.
I'm curious though, what can you do to a 'button' that you can't do to a 'submit'?
Posted: Wed Sep 27, 2006 1:04 pm
by ssettlemyre
you can have any code you want inside a <button></button> tag. Images, tables, etc...
and it's helpful because you can just reference it in css instead of using <input type="submit" class="blah">
Posted: Wed Sep 27, 2006 4:33 pm
by panic!
or you could use a hidden
<input type="hidden" name="submitted" value="yes"/>
or you could just write
if($_POST){
}