Editing a Search Form

It seems that you use a plugin to display this form. If you use a plugin and you can’t modify plugin scripts, I advice you to use CSS. You can add this line to style.css of your theme (Go to Appearance > theme editor) : .iw-search-add-advanced {display:none!important;} /*not display advance button */ .iw-fields-advanced {display:block!important;} /* … Read more

jQuery Validation plugin and Bootstrap 4 CSS classes

I found this solution: $.validator.setDefaults({ highlight: function (element, errorClass, validClass) { $(element).addClass(‘is-invalid’); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass(‘is-invalid’); } }); This is my previous personal solution: signup_form.on( ‘change submit’, function( e ) { $( ‘.error’ ).removeClass( ‘is-valid’ ).addClass( ‘is-invalid’ ); $( ‘.valid’ ).removeClass( ‘is-invalid’ ).addClass( ‘is-valid’ ); } ); Which is better?

Redirect when user clicks on an image

You have 2 ids with the same name and the form gets broken, always provide different ids on a page: <form method=’post’ id=’back_button_form’ action=”> <p class=”form-submit”> <input name=”back_button_img” type=”image” id=’back_button_img’ src=”https://wordpress.stackexchange.com/questions/345310/back.png”/> </p> </form>

Getting values from form and saving in database but spaces are inserted instead of form values

<?php /* Template Name: Dummy Practice Page*/?> <div id=”main-content” class=”main-content”> <div class=”main-content-inner”> <form method=”post”> <p><div> <input name=”nametxt” id=”nametxt” type=”text” style=”height:30px; width: 350px; ” maxlength=”5″ placeholder=”Name” required><br> </p></div> <p><div> <input name=”designationtxt” id=”designationtxt” type=”text” style=”height:30px; width: 350px; ” maxlength=”50″ placeholder=”Designation” required><br> </p></div> <p><div> <input name=”descriptiontxt” id=”descriptiontxt” type=”text” style=”height:30px; width: 350px; ” maxlength=”1000″ placeholder=”Description” required><br> </p></div> <input id=”submitbtn” … Read more

form submission reverts to index.php template

I did some testing locally with your code. I think the problem is your form input names clashing with names reserved by WP. Also redirecting to success/error page should happen before get_header() to avoid any headers sent errors. So, add some prefix/suffix to your input names, like so <input type=”text” name=”my-name” placeholder=”Your Name” class=”input” id=”name” … Read more