jquery - A little confusion over Sign up process in PHP -


i new php trying things differently make selft more proficient. here trying save data on database couldn't bale data's not saving in datbase during signup.

here code.

<?php $connection=mysqli_connect("localhost","root",""); $connection=mysqli_select_db("cinderella"); or die(mysqli_error($connection)); ?> 

<?php include('config.php'); if(isset($_post['action'])) {              if($_post['action']=="signup")     {         $name       = mysqli_real_escape_string($connection,$_post['name']);         $email      = mysqli_real_escape_string($connection,$_post['email']);         $password   = mysqli_real_escape_string($connection,$_post['password']);     $phone   = mysqli_real_escape_string($connection,$_post['phone']);     $country   = mysqli_real_escape_string($connection,$_post['country']);     $city   = mysqli_real_escape_string($connection,$_post['city']);     $zip   = mysqli_real_escape_string($connection,$_post['zip']);         $query = "select email registration email='".$email."'";         $result = mysqli_query($connection,$query);         $numresults = mysqli_num_rows($result);         if (!filter_var($email, filter_validate_email)) // validate email address         {             $message =  "invalid email address please type valid email!!";         }         elseif($numresults>=1)         {             $message = $email." email exist!!";         }         else         {             mysql_query("insert registration(name,email,password,phone,country,city,zip) values('".$name."','".$email."','".md5($password)."','".$phone."','".$country."','".$city."','".$zip."')");             $message = "signup sucessfully!!";         }     } } ?> 

<html>      <script type="text/javascript" src="jquery.min.js"></script>  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <body>     <form action="php/sign.php" method="post" class="signup">     <p><input id="name" name="name" type="text" placeholder="name"></p>     <p><input id="email" name="email" type="text" placeholder="email"></p>     <p><input id="password" name="password" type="password" placeholder="password">      <p><input id="phone" name="phone" type="text" placeholder="phone"></p>       <p><input id="country" name="country" type="text" placeholder="country"></p>        <p><input id="city" name="city" type="text" placeholder="city"></p>         <p><input id="zip" name="zip" type="text" placeholder="zip"></p>      <input name="action" type="hidden" value="signup" /></p>     <div>                               <center>                                   <span style="color:green;display:none;" class="sign-footer"><h4 style="margin-left: 0px;">registered .please login  </h4></span>                                   <span style="color:orange;display:none;" class="signerror-footer"><h4 style="margin-left: 0px;">please check email </h4></span>                                 </center>                           </div>     <p><input type="submit" value="signup" /></p>   </form>     <script type="text/javascript">            var frm = $('.signup');           frm.submit(function (ev) {               $.ajax({                   type: frm.attr('method'),                   url: frm.attr('action'),                   data: frm.serialize(),                   success: function (data) {             //alert(data);                       if (data) {                         //alert('data');                         $('.sign-footer').css('display','block');                       }                       else{                         $('.signerror-footer').css('display','block')                       }                   }               });                ev.preventdefault();           });       </script> </body> </html> 

any on me lot,.... thank ...


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -