matrixrp Posted March 2, 2009 Share Posted March 2, 2009 Hello i am making simple registration page and a'm using two submit buttons one to check if username is available(it is not in use) and one for processing the whole form and is there a way of doing this. Quote Link to comment Share on other sites More sharing options...
revraz Posted March 2, 2009 Share Posted March 2, 2009 Just use two different names, but really I don't see the point. Just check if it's unique when they submit to apply. Quote Link to comment Share on other sites More sharing options...
premiso Posted March 2, 2009 Share Posted March 2, 2009 Why not just check if the username is not available when they post the data with the main submit button? 2 submit buttons is not a viable option in my opinion. Why make them post twice, when once is all that is needed. Quote Link to comment Share on other sites More sharing options...
a-scripts.com Posted March 2, 2009 Share Posted March 2, 2009 pretty weird .. but yeah use different names for buttons and it's ok .. <input type="submit" name="btnCheckUsername"/> <input type="submit" name="btnSubmitForm"/> .. Then you can check which one was clicked if( isset( $_POST['btnCheckUsername'] ) ) { // do some username checks } elseif( isset( $_POST['btnSubmitForm']) ) { // process the whole form } Quote Link to comment Share on other sites More sharing options...
matrixrp Posted March 2, 2009 Author Share Posted March 2, 2009 Thanks for your help. Anyway i was just trying this because when user clicks check 'username' button if is available it will appear one image and if it is not then different image will appear that's why i was asking, any way thanks for your help Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 2, 2009 Share Posted March 2, 2009 Well, I agree that you HAVE to check the username for uniqueness when the complete form data is ultimately submitted, but you *COULD* have another button to check the username. But, you would want to do so with AJAX - otherwise the user might enter data for the entire form and submit only to have the username checked. But, that gets more complex than just checking it on the complete form submission. If you go with only checking it on the complete form submission (which you have to do anyway) you will have a working solution. You can aways add a feature for the user to check for available usernames at a later time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.