- Using a PHP Include, connects to a database to retrieve the 'protected' form values, specified by the primary key
- Fetches an array containing the 2 values (using a while loop)
- Posts the info from the 1st form
- Builds a new form containing the info from the 1st form, to which the 2 required fields are appended, but with empty values
- The PHP Include then prints a link to a .js file
- JS inserts the variables (specified in the PHP Include) in the form values
- The PHP Include is supposed to read the 2 variables and replace them with the output of the fetched array
- A JS onLoad would then submit the form to the payment processor
The problem is, once the JS inserts the variables, the PHP include has already run, and doesn't replace the variables with the data from the fetched array.
So question 1 is, how to get that working? I've tried breaking out the while loop and inserting it after the JavaScript; removing the JS document.ready, etc. but nothing seems to work.
Question 2 is, does PHP have a way to determine if the requesting browser has JavaScript disabled, so I could write something like:
Code: Select all
if (!JavaScript){
exit;
}
else {
$includeJS = '<script type="text/javascript" src="path/to/include.js"></script>';
}Thanks,