form action wordpress and php

If you’re using WordPress, you shouldn’t send POST requests directly to current URL. There is an API to process such requests. So how should that be done? First of all, you should send request to admin-ajax.php: So instead of this: <from action=”<?php get_permalink( $post->ID ) ?>” method=”POST” id=””> You should have this (also, there was … Read more

How to check form input against PHP variable?

Your problem is this bit: $input = $vCode That is not comparing the variables. It’s assigning the value of $vCode to $input. If you want to compare the two values, you need to use == or ===. $input == $vCode It still wouldn’t work though, because you haven’t actually defined $input. You’re only defining it … Read more

Stop SPAM from custom form

I’ve been studying (and blocking) automated form spam for years. Most advice relates to hidden fields, CSS tricks, ‘stupid’ questions (“what is 1+3”), and others. And the reason that those tricks (and others) don’t work with automated spam bots is that they don’t ‘see’ your form, they just post to it. They scrape the form, … Read more

comment form name and email not working?

Incorrect field names ‘author’ => ‘<div class=”row padding-xs-top”> <div class=”col-md-4 col-sm-4″> <div class=”form-group ct-form-group-label–float”><label for=”contact_name”>’ . ‘</label> <span class=”required”></span><input id=”contact_name” name=”author” class=”form-control input-lg” type=”text” value=”Name *”‘ . esc_attr( $commenter[‘comment_author’] ) . ‘” required=”required” /></div></div>’, ’email’ => ‘<div class=”col-md-4 col-sm-4″> <div class=”form-group ct-form-group-label–float”><label for=”contact_email”>’ . ‘</label> <span class=”required”></span><input id=”contact_email” name=”email” class=”form-control input-lg” type=”email” value=”Email *”‘ . … Read more

How to code auto-retry for API call

First you should save the data somewhere in your wordpress. I personally like to use custom tables. Then use a schedule (cron job) to check if there is new data. Then try to submit the data. If you sumitted the data successfully delete it or mark your local data as successfully submitted. Else retry it … Read more

Programmatically populate form fields with data

Is there a general form and form data handling mechanism in WordPress that I can facilitate for this, like e.g. WordPress has a form object containing a “field” or data object for each of the form’s fields, allowing me to access the form(s) on a page? No, there is not. I actually wouldn’t even need … Read more

Form submission in WordPress front end

You have multiple way yo handle form submition, one of those is a post action. But first you need to create the proper form attributes and tags for it to work, so it should look something like this. HTML <form action=”<?= esc_url(admin_url(‘admin-post.php’)); ?>” method=”post”> <!– this will “indicte” to the hook that will handle the … Read more

free form wordpress

you can do that very simply with contact form 7 plugin that lets you send two emails on every form submit, so on the first mail collect all of the form fields and send it to your self and in the 2nd email just mail the user the voucher. Hope this helps