Saving form data to database

Issues related to forms.
Post Reply
krwysi
 
 
Posts: 19
Joined: Wed Feb 21, 2024 10:47 pm

Saving form data to database

Post by krwysi »

Hi I want to save form data to a database, and have filled in the info on the "advanced" section, however, when the page is published, the script still has all the email info, eg
$mailto = '';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = '';
$message = '';

Does the email info have to be completed/does the form have to be emailed as well as saved to the database? We have no need for the form to be sent by email.
Thanks.
wwonderfull
 
 
Posts: 1439
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: Saving form data to database

Post by wwonderfull »

If you have not the need of sending the email and only sending the data to database, then just do not use the SMTP along with the Malito option keeping them blank. But for user experience make sure to direct to the success or error page.

And make sure you have MySQL configured on the advanced form property.

You will find the database settings in Form Processing section where there is an option called Advanced.
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Saving form data to database

Post by Pablo »

If the Email Address field is left blank, no email will be sent. However, the 'mail' code will still be included in the script, as it's part of the generic script.
Post Reply