El_Dudereno Posted August 3, 2009 Share Posted August 3, 2009 I have created a text box to take in a bank sort code in the format [0-9][0-9]-[0-9][0-9]-[0-9][0-9] <input type="text" name="Bank_Sort_Code" maxlength="8" /> I have created a function to validate the entry function validateBankNo($Bank_Sort_Code) { if(ereg('^[0-9]{2}-[0-9]{2}-[0-9]{2}$', $Bank_Sort_Code)) return true; else return false; } I have created a button to call the fuction when the text box has been filled to see if the entered data is correct. My problem is I can't get the three pieces of code to fit together. Any help would be great. Link to comment https://forums.phpfreaks.com/topic/168644-calling-functions-in-button/ Share on other sites More sharing options...
watsmyname Posted August 3, 2009 Share Posted August 3, 2009 I have created a text box to take in a bank sort code in the format [0-9][0-9]-[0-9][0-9]-[0-9][0-9] <input type="text" name="Bank_Sort_Code" maxlength="8" /> I have created a function to validate the entry function validateBankNo($Bank_Sort_Code) { if(ereg('^[0-9]{2}-[0-9]{2}-[0-9]{2}$', $Bank_Sort_Code)) return true; else return false; } I have created a button to call the fuction when the text box has been filled to see if the entered data is correct. My problem is I can't get the three pieces of code to fit together. Any help would be great. seems you are calling php function on button click, is it not possible easily, you can find some third party script to do that for you, but for this simple thing you may want to use javascript function rather than php function to call on button click Link to comment https://forums.phpfreaks.com/topic/168644-calling-functions-in-button/#findComment-889653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.