Form Security: nonce vs. jQuery

jQuery is a js library not a transport protocol, your data is sent via GET or POST, wether you use jquery or not. Think of it like this, sometimes it’s the user in the first frame, sometimes it’s javascript: Firstly nonces are not the same as sanitisation, they have different purposes Sanitisation is about verifying … Read more

db converts decimal number wrong

Within $wpdb->insert, you are using %d which is used to store integer, use %f instead which will store float/decimal values. $registrering = $wpdb->insert( $wpdb->prefix . ‘registreringer’, array( ‘fiske_vaegt’ => $fiske_vaegt ), array( ‘%f’ ) );

How to show a ‘correct’ message after submit a form?

I solved the problem. First I check if there are errors and then I add a custom redirect url like this: if ( count($error) == 0 ) { wp_redirect( get_permalink() . ‘?updated=true’ ); } And finally I added a message using ‘GET’ method: <?php if ( $_GET[‘updated’] == ‘true’ ) : ?> <p class=”form-submit-success” style=”color: … Read more

Pass data from one page to anothe file/page in wordpress

You can try to use functions.php to handle the form submission and send the data via AJAX. Add a hidden field in your form with the action to be taken (on functions.php): <input type=”hidden” name=”action” value=”save_contact”/> In you footer.php add the jQuery code to handle the AJAX request: jQuery(‘#your-form’).submit(ajaxSubmit); function ajaxSubmit(e){ e.preventDefault(); var formData = … Read more

Display all WP Errors together during form validation

Sorry to bother . It was one of my other functions which was limiting the error to echo only once. Here is the previous code : function display_message( $message = false ) { if( is_wp_error( $message ) ) { echo ‘<div class=”error”><p>’ . $message->get_error_message() . ‘</p></div>’; } It worked fine when i changed it too … Read more

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