isset( $_POST[‘submitted’])) Not working with hidden fields & wp_nonce_field()

I try to implement google recaptcha v2 using isset( $_POST[‘submitted’])) method on form submittion. But it’s not working because of hidden fields & wp_nonce_field(). And form submitted without checking isset function.

Below two line of code is for hidden fields and wp_nonce_field() function.

<input type=”hidden” name=”action” value=”<?php echo esc_attr( $action ); ?
>”>
<?php wp_nonce_field( $action ); ?>

Below code is for Form submit button with name “submitted”.

<button type=”submit” id=”submitted” name=”submitted” value=”submitted”>>
</button>

I try to use,

if(isset( $_POST[‘submitted’])){
//code for isset true, But not working
}else{
{

I also tried, if(($_SERVER[‘REQUEST_METHOD’] == ‘POST’)) method, But is also not working.

Please guide me to solve this issue.

Read more here:: isset( $_POST[‘submitted’])) Not working with hidden fields & wp_nonce_field()

Leave a Reply

Your email address will not be published. Required fields are marked *