I created a wordpress page that includes a form that emails to the admin some information with an attachment. I made this form without any plugins.
I'm wondering how would I have the form save data into the wordpress database which would be accessible to me?
Should I have used a plugin? I rather not to because I already worked hard without it. Yet i've seen ways where people saved to the database with the plugin.
In my code, I included the form html inside the get header/footers for a php page. and here is part of the code of how I mail the information itself:
$message .= '<table rules="all" style="border-color: #81476d;" cellpadding="10">';
$message .= "<tr><h3 style='Color: #81476d'>General: </h3></tr>";
$message .= "<tr><td><strong>Full Name: </strong></td><td>" . $fullname . "</td></tr>";
$message .= "<tr><td><strong>Email Address: </strong></td><td>" . $email . "</td></tr>";
$message .= "<tr><td><strong>Subject: </strong></td><td>" . $Subject . "</td></tr>";
include_once(ABSPATH . WPINC . '/class-phpmailer.php');
$pmail = new PHPMailer();
$pmail->From = strip_tags($email);
$pmail->FromName = $fullname;
$pmail->Subject = $subject;
$pmail->IsHTML(true);
$pmail->AddAddress(get_option('admin_email'), 'Simon');
$pmail->AddAttachment($_FILES['Photo']['tmp_name'], $_FILES['Photo']['name']);
$pmail->Body = $message;
if($pmail->Send()) my_contact_form_generate_response("success", $message_sent);
else my_contact_form_generate_response("error", $message_unsent);