PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ssettlemyre
Forum Newbie
Posts: 3 Joined: Wed Sep 27, 2006 12:31 pm
Post
by ssettlemyre » Wed Sep 27, 2006 12:40 pm
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)
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Wed Sep 27, 2006 12:42 pm
is there a question in there somewhere??
ssettlemyre
Forum Newbie
Posts: 3 Joined: Wed Sep 27, 2006 12:31 pm
Post
by ssettlemyre » Wed Sep 27, 2006 12:44 pm
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.
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Wed Sep 27, 2006 12:57 pm
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'?
ssettlemyre
Forum Newbie
Posts: 3 Joined: Wed Sep 27, 2006 12:31 pm
Post
by ssettlemyre » Wed Sep 27, 2006 1:04 pm
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">
panic!
Forum Regular
Posts: 516 Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK
Post
by panic! » Wed Sep 27, 2006 4:33 pm
or you could use a hidden
<input type="hidden" name="submitted" value="yes"/>
or you could just write
if($_POST){
}