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.
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.
cron
not execute just report.php
, but report.php with the added query string, so it looks like: report.php?input_email=user@email.com
$variables
are replaced with their actual values, and then cron
can just execute hardcode.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.
Why not
- insert all values sent into a database
- retrieve all values in a new email.php file and run a loop that sends all reports?
That sounds like a solution to me and you can cron the email.php file