Jump to content

Calling functions in button


El_Dudereno

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.