I am creating an E-mail Reporting System to send scheduled e-mails (daily, weekly, etc.) with the results of certain SQL
queries.
I have one HTML
& JQuery
page, generate.html, containing a form which allows a user to customize the report. The form enables the user to change certain variables of the SQL
query to be executed.
These variables are passed to a PHP
file, report.php, which contains the queries and handles e-mailing the results.
For Example
A user inputs an e-mail address on the HTML
form and submits. report.php receives this variable through $input_email = trim($_REQUEST['input_email']);
.
My problem lies in using cron
to execute the report.php file on a scheduled basis. I have not tried it, but I am pretty sure that when cron
executes report.php, it will see $input_email
in the PHP
file and not know what to do with it.
I see two solutions
- Have
cron
not execute justreport.php
, but report.php with the added query string, so it looks like:report.php?input_email=user@email.com
- Duplicate the report.php file into a new file, hardcode.php, where all the
$variables
are replaced with their actual values, and thencron
can just executehardcode.php
on it's own
I wish to implement the second solution, but cannot figure out how. I am relatively new to PHP and JQuery. Any help would be greatly appreciated! Thank you.