Howdy y'all,
Got a question, why were here right, I have a page that is server side - no html included all php - I need to call/include a javascript function to handle a rather complex parsing routine but I am not sure how I go about calling the function inside this page...the information that I need to parse is being sent as a post from a form...
As an example lets say that I have the following:
<?PHP
//Remove dangerious and unwanted charectors from the form input
function StripSpecChar($val) {
return (preg_replace('/[^a-zA-Z0-9" "-.@\:\/_]/','', $val));
}
//Convert POST data field from the form to PHP Session
foreach ($_POST as $key => $val) {
$_SESSION[$key] = StripSpecChar($val);
}
$string = $_SESSION['reader'];
//RUN JS FUNCTION HERE AGAINST $string
//Return true/false results here
//Continue PHP processing here
?>
The function that I am need to run takes a data string from a magnetic strip swipe, breaks it into its parts based on landmarks in the string then I need to validate 2 sets of data in the string i.e. an employee id number and the issue date. If those pass the checks then I need to fire off the rest of the php that allows the data to be processed or error back that they need to try swiping the badge again etc...
I have both parts working as stand alone pieces but I don't know how to fuse them together...