Link to home
Start Free TrialLog in
Avatar of Rodrigo Costa
Rodrigo CostaFlag for New Zealand

asked on

How to read variable from php form in Javascript

Hi folks I need to make a variable passed to the current php file to be able to be read from a javascript that is within this php file.

The variable is passed from a form as $stri , I need to acces this variable from the following javascript:

if(variableName.match(/for123/i)){
  alert("matched");
}else{
  alert("not matched");
}                                            

Open in new window


Any help would be much appreciated.
Cheers!
ASKER CERTIFIED SOLUTION
Avatar of Member_2_6009151
Member_2_6009151
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rodrigo Costa

ASKER

Yep that is it exactly. Cheers mate!