0

So im new to wp/themes,and coding, but love it and love trying to build sites, I used the form from the theme, extracted only the email field and added a button on that field basically inside of that field, now i want that button to add whatever email entered to be added to a database. Fields like name,surname ,pass.. thats not important , im only focused on the email.

i would also like to have a message error if not an email or email is already added..

im not 100% sure if this is possible doing custom but its worth asking.

This is my form code '

<form id="contact-form" class="footer-contact-form" method="post" action="
<?php 
echo esc_url($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); ?>">

<div class="input-container col-md-6 home_form">
        <input type="email" id="email" class="email" name="email" placeholder="<?php esc_attr_e('Email', 'gourmet'); ?>*" required value="">
</div>

<div class="input-container col-md-12 sub_home_but">
    <button type="submit" class="res-button custom-button home_but button-style8">
    </button>
</div>
</form>
0

1 Answer 1

0

You will need a function to process the data submitted by the form. You can use admin_post_ hook to process the data. This hook allows you to create custom handlers for your own custom GET and POST requests.

To save the data into the database, you can create a new table or Post Meta. Before jumping to the new table, consider storing your data in WordPress 'Post Meta'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.