ajax form is returning the dreaded “[HTTP/1.1 400 Bad Request” and a zero

Your hook name uses an underscore: add_action( ‘wp_ajax_save_form’, ‘save_form’ ); add_action( ‘wp_ajax_nopriv_save_form’, ‘save_form’ ); But your action uses a hyphen. action: ‘save-form’ These need to match: action: ‘save_form’ Also, your AJAX callback appears to be in apps/save_signups.php, but you are only requiring that file inside the admin_menu hook: require_once ( ‘apps/save_signups.php’ ); //process submitted 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

WordPress shortcode returns the data before

Change form.php <form action=”<?= $_SERVER[“REQUEST_URI”]; ?>” method=”post”> <input type=”hidden” name=”form_submit_nonce” value=”<?php echo wp_create_nonce(‘form-submit-nonce’); ?>”/> <label for=”id”>ID</label> <input id=”id” name=”id” type=”text” value=”” required /> <input type=”submit” name=”submitid” value=”Submit”> </form> Change plugin file function form_shortcode(){ if ( isset( $_POST[“submitid”] ) && isset($_POST[‘form_submit_nonce’]) && wp_verify_nonce($_POST[‘form_submit_nonce’], ‘form-submit-nonce’) ) { echo “<p>OK</p>”; } else { include “form.php”; } } add_shortcode( … Read more

Saving contact form 7 data into custom Table

CF7 has an useful hook wpcf7_submit that can be used to process the data sent: add_action(“wpcf7_submit”, “SE_379325_forward_cf7”, 10, 2); function SE_379325_forward_cf7($form, $result) { if( !class_exists(‘WPCF7_Submission’) ) return; $submission = WPCF7_Submission::get_instance(); if ($result[“status”] == “mail_sent”) { // proceed only if email has been sent $posted_data = $submission->get_posted_data(); save_posted_data($posted_data); } }; // your insert function: function save_posted_data($posted_data){ … Read more

What is the alternative code to if (isset ($_POST) && !empty ($_POST) to avoid warnings?

filter_input is the proper way to go. If it doesn’t return anything valid, it will return null: $myvar = filter_input( INPUT_POST, ‘something’, FILTER_SANITIZE_STRING ); if ( empty( $myvar ) ) { // Do whatever you would have done for ! isset( $_POST[‘something’] ) } // Use $myvar filter_input won’t throw any notices if the requested … Read more

Match tag names with form titles

I don’t see PHP syntax errors (like unwanted brackets) in your code, but there are two WordPress-specific issues that need to be fixed: Note that wpdb::prepare() needs one or more placeholders (e.g. %s for strings and %d for numbers) and the replacement value for each placeholder. So in your case, the correct $wpdb->prepare() would be: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)