i need a advice, basically i have a multistep wizard form, and in this wizard, for marketing purposes i need to save in the first step (name, email, address) to the database, case the user dont finish all the wizard steps.
But i need to create a email notification to the administrator case the user doesnt finish the form. So what i think was for example in cpanel create a cronjob that verifies in my database for records that doesnt have completed the multistep and than send a email to the administrator with there emails.
But there is a issue, i need to update a column in my records, in my case a column called “verified” that is boolean and when the mail is sent but to true so that every time the cronjob fires up dont send always emails to the administrator.
But it looks like that cronjob only supports Get method, does anybody have a advice?
2
Answers
Request method (Get, post, put,…) is http-specific. When you run your code in the terminal (cronjob) you do not have a request method.
You should create a script (or command depending if you use a framework) that checks everything and changes the value in the database.
Request methods (GET, POST, PUT, DELETE, etc.) are HTTP-specific, not CRON jobs.
This is wrong. Cron jobs are to call specific file(s) on a specified time interval. You can read it here: Cron Jobs
In your case, you need to following things:
database. So, you can save using 2 columns in the database, 1 is to check the users who have not completed the form and 2nd is to check if the email is already sent to them.
Suppose 2 columns are
is_incomplete
(to check users who have notcompleted the form) and
is_followup_email_sent
(to check if the emailis sent for further follow ups).
In your CRON file path, you don’t need to specify any GET param until
its needed. You just need to call a file placed on your server and in
that file, you need to connect to the database to get users where
is_incomplete = 1
(form not completed) and then make anotherfunction to send email to this list of users and set
is_followup_email_sent = 1
(that means email is already sent)the top that you get all those users where
is_incomplete =
1 andis_followup_email_sent = 0
i.e. users who have not completed theirform and admin email is not sent to them yet.
I hope this will help you! Cheers.