How to update form data inserted in database in wordpress?
update form data inserted in database in wordpress if(isset($_POST[‘contactformupdate’])) { $id = $_REQUEST[‘id’]; extract($_POST); global $wpdb; $table_name = $wpdb->prefix . “my_plugintable”; if(($wpdb->update($table_name, array(‘firstname’=>$firstname, ‘lastname’=>$lastname, ’email’=>$email, ‘phone’=>$phone, ‘message’=>$message), array(‘ID’=>$id)))){ $msg = “Your message has been sent!”; } else { $msg = “Something is wrong!”; } } get_header(); ?> <div id=”primary” class=”content-area”> <main id=”main” class=”site-main”> <?php $id […]
How to Show or hide a div by using jQuery?
Show or hide a div by using jQuery <!– html code as example–> <div class=”login-form”>…,</div> <div class=”signup-form”>…,</div> <div class=”create-account-bar”><span class=”msg1″>Don’t have account?</span><span class=”msg2″>Already have an account?</span> <span class=”signup” >Sign Up</span><span class=”signin” >Sign In</span></div> <!–jQuery code–> <script type=”text/javascript”> jQuery(document).ready(function($){ $(“.signup”).click(function(){ $(“.login-form”).hide(); $(“.msg1”).hide(); $(“.msg2”).show(); $(“.signup-form”).show(); $(“.signin”).show(); $(this).hide(); }); $(“.signin”).click(function(){ $(“.login-form”).show(); $(“.signup-form”).hide(); $(“.signup”).show(); $(“.msg1”).show(); $(“.msg2”).hide(); $(this).hide(); }); }); […]
How to validate Basic sign up form in php?
Validate sign up form in php if(isset($_POST[‘signup’])) { extract($_POST); global $wpdb; $table_name = $wpdb->prefix . “shopkeeper_signup”; $results = $wpdb->get_results ( “SELECT * FROM $table_name where phonenumber=$phonenumber” ); if((count($results)) < 1 ){ if(($wpdb->insert($table_name, array( ‘fullname’ => $fullname, ‘phonenumber’ => $phonenumber, ‘pass’ => $pass, ‘time’ => date(‘d-m-Y’), )))){ $msg = “Thank You!<br>You are now registered with us.<br>click […]
A Basic Responsive login form Example
A Basic Responsive login form Example <div class=”login-wrapper” id=”div1″> <img src=”<?php echo site_url(); ?>/wp-content/uploads/2020/01/grahakbook_logo-294×300.png” width=”100px”> <p>Manage your grahak digitally.</p> <?php if(empty($msg)){?> <form method=”post” action=”” class=”login-form”> <h3>SIGN IN</h3> <div class=”wrap-input100 validate-input” data-validate=”Enter username”> <input class=”input100″ type=”text” name=”username”> <span class=”focus-input100″ data-placeholder=”Username”></span> </div> <div class=”wrap-input100 validate-input” data-validate=”Enter password”> <input class=”input100″ type=”password” name=”pass”> <span class=”focus-input100″ data-placeholder=”Password”></span> </div> <input type=”submit” […]
How to enable show password function in login form?
Enable show password in login form //html code <!– Password field –> Password: <input type=”password” value=”FakePSW” id=”myInput”> <!– An element to toggle between password visibility –> <input type=”checkbox” onclick=”myFunction()”>Show Password //js code <script> function myFunction() { var x = document.getElementById(“myInput”); if (x.type === “password”) { x.type = “text”; } else { x.type = “password”; } […]
How to redirect a page to another page in php?
Redirect a page to another page in php function logoutpage(){ echo ‘<script LANGUAGE=”JavaScript”>window.location.href=”‘.site_url().’/logout/”;</script>’; } function dashboard(){ echo ‘<script LANGUAGE=”JavaScript”>window.location.href=”‘.site_url().’/dashboard/”;</script>’; } function loginpage(){ echo ‘<script LANGUAGE=”JavaScript”>window.location.href=”‘.site_url().'”;</script>’; } //Ex. code used in logouy page <?php /* Template Name: Logout */ session_start(); session_destroy(); session_unset(); loginpage(); ?> <script> location.reload(); </script>