Add Custom Field and email message
-
I have a form in php in “single.php” from my site (wordpress). In it, the person adds your email address and a specific message is sent to it.
I would like to modify this form for a custom field is sent along the message she receives.
What I need to modify my code?<? php if (isset ($ _POST ['action']) && $ _POST ['action'] == 'email-att ") { ??? if (is_email ($ _POST ['email'])) { ???????? $ to = $ _POST ['email']; ???????? $ subject = "email subject line"; ???????? $ message = "email message body"; ???????? $ attachments = array ('https://full_url_to_file.zip'); ???????? wp_mail ($ to, $ subject, $ message,'', $ attachments); ???????? echo 'Email sent! Check your email '; ???? else {} ???????? echo 'Please enter a valid email address'; ???? } } ?>
<form name="email-att" id="email-att" method="POST" action=""> Enter your emial: <br /> <input type="text" name="email" id="email"/> <br /> <input type="hidden" name="action" value="email-att"/> <br /> <input type="submit" name="submit" value="Submit" id="submit"/> </ form>
- The topic ‘Add Custom Field and email message’ is closed to new replies.