php - info doesn't get inserted to table -


my problem that, not insert info table, please read code , tell me problem thanks.also don't errors db. because thing won't stop bugging me telling more details,im going type survive lyric stops @ first afraid,i petrified,kept thinking never live,without side,but spent many nights,thinking how did me wrong,i grew strong,i learned how along

this html:

<div id="middle" class="col">     <br><br>     <p class="text-center"><strong> فرم ثبت نام</strong></p>     <br><p class="text-center"> اجباری<span><strong style="color:red">&nbsp *</strong></p><br>    <form method="post" style="height:70vh; width:47vw; text-align:center;" action="">     <table width="75%">          <tr>             <td align="right"><span class="error"><?php echo $usernameerr?></span></td>             <td align="right"><input type="text" name="username" value="<?php echo $username?>"></td>             <td style="font-size:medium" align="right" height="1.5em">:شناسه<font color="red">&nbsp;*</font>&emsp;</td>         </tr>          <tr>             <td align="right"><span class="error"><?php echo $passworderr?></span></td>             <td align="right"><input type="password" name="password" value="<?php echo $password?>">             <td style="font-size:medium" align="right" height="1.5em">:رمزعبور<font color="red">&nbsp*</font>&emsp;</td>         </tr>          <tr>             <td align="right"><span class="error"><?php echo $password_checkerr?></span></td>             <td align="right"><input type="password" name="password_check" value="<?php echo $password_check ?>">             <td style="font-size:medium" align="right" height="1.5em">:تکرار رمز عبور<font color="red">&nbsp*</font>&emsp;</td>         </tr>          <tr>             <td align="right"><span class="error"><?php echo $fnameerr?></span></td>             <td align="right"><input type="text" name="fname" value="<?php echo $fname?>"></td>             <td style="font-size:medium" align="right">: نام<font color="red">&nbsp*</font>&emsp;</td>         </tr>          <tr>             <td align="right"><span class="error"><?php echo $lastnameerr?></span></td>             <td align="right"><input type="text" name="lname" value="<?php echo $lname?>"></td>             <td style="font-size:medium" align="right">: نام خانوادگی<font color="red">&nbsp*</font>&emsp;</td>         </tr>          <tr>             <td align="right"><span class="error"><?php echo $emailerr?></span></td>             <td align="right"><input type="email" name="email" value="<?php echo $email?>"></td>             <td style="font-size:medium" align="right">:پست الکترونیک<font color="red">&nbsp*</font>&emsp;</td>         </tr>          <tr>             <td align="right"><span class="error"><?php echo $phone_numbererr?></span></td>             <td align="right"><input type="text" name="phonenumber" value="<?php echo $phonenumber?>" ></td>             <td style="font-size:medium" align="right">:تلفن ثابت<font color="red">&nbsp*</font>&emsp;</td>         </tr>          <tr>             <td align="right"><span class="error"><?php echo $cellphone_numbererr?></span></td>             <td align="right"><input type="text" name="cellphonenumber" value="<?php echo $cellphonenumber?>" ></td>             <td style="font-size:medium" align="right">:موبایل<font color="red">&nbsp*</font>&emsp;</td>         </tr>          <tr>             <td colspan=3 align=right>             <table border=0>                 <tr><br>                 <td colspan="2">                     <input type="text" name="state" value="<?php echo $state?>" >                 </td>                 <td colspan=2 align=right>                     &emsp;&emsp;:استان<font style="font-size:medium" color="red">&nbsp*&emsp;&emsp;&emsp;&ensp;</font>                 </td>             </tr>              </table>             <table>             <tr>                 <td><span class="error"><?php echo $addresserr?></span></td>                 <td> <textarea name="address" row+4><?php echo $address?></textarea></td>                 <td style="font-size:medium" colspan=2 align="right">&ensp;:نشانی<font color="red">&nbsp*&emsp;&emsp;&emsp;&ensp;</font></td>             </tr>              <tr>                 <td align="right"><span class="error"><?php echo $zipcodeerr?></span></td>                 <td align="right"><input type="text" name="zipcode" value="<?php echo $zipcode?>"></td>                 <td id="address" style="font-size:medium" colspan=2 align="right">&ensp;:کد پستی<font color="red">&nbsp*&emsp;&emsp;&emsp;&ensp;</font></td>             </tr>          </table>         <br><span class="text-center"><input type="submit" name="submit" value="ثبت" style="height:3vh"></span>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;   </form>   

this php,mysql:

    <?php     // define variables , set empty values     $zipcode = $username = $password = $password_check = $lname = $state      = $fname = $email = $cellphonenumber = $address = $phonenumber ="";       $zipcodeerr = $usernameerr = $passworderr = $password_checkerr = $lastnameerr = $stateerr      = $fnameerr = $emailerr = $cellphone_numbererr = $addresserr = $phone_numbererr = "";       $anyerror=0;     // create connection     $conn = new mysqli('localhost', 'root', '', 'mysql');  // check connection     if ($conn->connect_error)         die("connection failed: " . $conn->connect_error);      $sql = "create table if not exists myusers6 (             id int(6) unsigned auto_increment,             username varchar(30) not null,             password varchar(30) not null,             fname varchar(30) not null,             lname varchar(30) not null,             phonenumber varchar(30) not null,             cellphonenumber varchar(30) not null,             email varchar(50) not null,             state varchar(50) not null,             address varchar(50) not null,             zipcode varchar(50) not null,             reg_date timestamp,             primary key (id)     )";      if ($conn->query($sql) === false)         echo "error creating table: " . $conn->error;        if ($_server["request_method"] == "post") {       if (empty($_post["username"])){         $usernameerr ="لطفا شناسه خود را وارد نمایید";         $anyerror=1;}     else         $username = test_input($_post["username"]);      if (empty($_post["state"])){         $stateerr ="لطفا شناسه خود را وارد نمایید";         $anyerror=1;}     else         $state = test_input($_post["state"]);       if (empty($_post["password"])){         $passworderr = "لطفا رمزعبور خود را وارد نمایید";         $anyerror=1;}     else         $password = test_input($_post["password"]);       if (empty($_post["password_check"])){         $password_checkerr = "لطفا رمزعبور را دوباره وارد کنید";         $anyerror=1;}     if(strcmp($password,$password_check) ==0 && isset($_post["password_check"])){         $password_checkerr = " رمز عبور ها یکسان نیستند";         $anyerror=1;}     else         $password_check = test_input($_post["password_check"]);       if (empty($_post["fname"])) {         $fnameerr = "لطفا نام خود را وارد نمایید";         $anyerror=1;}     else          $fname = test_input($_post["fname"]);       if (empty($_post["lname"])) {         $lastnameerr = "لطفا نام خانوادگی خود را وارد نمایید";         $anyerror=1;}         else          $lname = test_input($_post["lname"]);       if (empty($_post["email"])) {         $emailerr = "لطفا ایمیل خود را وارد نمایید";         $anyerror=1;}     elseif (filter_var($email, filter_validate_email)) {         $emailerr = "فرمت ایمیل غیرمجاز است";         $anyerror=1;     }     else          $email = test_input($_post["email"]);       if (empty($_post["phonenumber"])) {         $phone_numbererr = "لطفا شماره تلفن خود را وارد نمایید";         $anyerror=1;}     else          $phonenumber = test_input($_post["phonenumber"]);       if (empty($_post["address"])) {         $addresserr = "لطفا نشانی خود را وارد نمایید";         $anyerror=1;}     else          $address = test_input($_post["address"]);       if (empty($_post["cellphonenumber"])) {         $cellphone_numbererr = "لطفا شماره موبایل خود را وارد نمایید";         $anyerror=1;}     else          $cellphonenumber = test_input($_post["cellphonenumber"]);       if (empty($_post["zipcode"])) {         $zipcodeerr = "لطفا شماره موبایل خود را وارد نمایید";         $anyerror=1;}     else          $zipcode = test_input($_post["zipcode"]);       if ( $anyerror = 0 )             $sql = "insert myusers6 values ('$username' ,'$password', '$fname', '$lname', '$phonenumber', '$cellphonenumber', '$email', '$state', '$address', '$zipcode')";           if ($conn->query($sql) === false)              echo "error: " . $sql . "<br>" . $conn->error;         else             echo "ssssssss";      }      function test_input($data) {         $data = trim($data);         $data = stripslashes($data);         $data = htmlspecialchars($data);         return $data;     }       ?> 

//change database name put code , check <?php     // define variables , set empty values     $zipcode = $username = $password = $password_check = $lname = $state      = $fname = $email = $cellphonenumber = $address = $phonenumber ="";       $zipcodeerr = $usernameerr = $passworderr = $password_checkerr = $lastnameerr = $stateerr      = $fnameerr = $emailerr = $cellphone_numbererr = $addresserr = $phone_numbererr = "";       $anyerror=0;     // create connection     $conn = new mysqli('localhost', 'root', '', 'test');  // check connection     if ($conn->connect_error)         die("connection failed: " . $conn->connect_error);      $sql = "create table if not exists myusers6 (             id int(6) unsigned auto_increment,             username varchar(30) not null,             password varchar(30) not null,             fname varchar(30) not null,             lname varchar(30) not null,             phonenumber varchar(30) not null,             cellphonenumber varchar(30) not null,             email varchar(50) not null,             state varchar(50) not null,             address varchar(50) not null,             zipcode varchar(50) not null,             reg_date timestamp,             primary key (id)     )";      if ($conn->query($sql) === false)         echo "error creating table: " . $conn->error;        if ($_server["request_method"] == "post") {       if (empty($_post["username"])){         $usernameerr ="لطفا شناسه خود را وارد نمایید";         $anyerror=1;}     else         $username = test_input($_post["username"]);      if (empty($_post["state"])){         $stateerr ="لطفا شناسه خود را وارد نمایید";         $anyerror=1;}     else         $state = test_input($_post["state"]);       if (empty($_post["password"])){         $passworderr = "لطفا رمزعبور خود را وارد نمایید";         $anyerror=1;}     else         $password = test_input($_post["password"]);       if (empty($_post["password_check"])){         $password_checkerr = "لطفا رمزعبور را دوباره وارد کنید";         $anyerror=1;}     if(strcmp($password,$password_check) ==0 && isset($_post["password_check"])){         $password_checkerr = " رمز عبور ها یکسان نیستند";         $anyerror=1;}     else         $password_check = test_input($_post["password_check"]);       if (empty($_post["fname"])) {         $fnameerr = "لطفا نام خود را وارد نمایید";         $anyerror=1;}     else          $fname = test_input($_post["fname"]);       if (empty($_post["lname"])) {         $lastnameerr = "لطفا نام خانوادگی خود را وارد نمایید";         $anyerror=1;}         else          $lname = test_input($_post["lname"]);       if (empty($_post["email"])) {         $emailerr = "لطفا ایمیل خود را وارد نمایید";         $anyerror=1;}     elseif (filter_var($email, filter_validate_email)) {         $emailerr = "فرمت ایمیل غیرمجاز است";         $anyerror=1;     }     else          $email = test_input($_post["email"]);       if (empty($_post["phonenumber"])) {         $phone_numbererr = "لطفا شماره تلفن خود را وارد نمایید";         $anyerror=1;}     else          $phonenumber = test_input($_post["phonenumber"]);       if (empty($_post["address"])) {         $addresserr = "لطفا نشانی خود را وارد نمایید";         $anyerror=1;}     else          $address = test_input($_post["address"]);       if (empty($_post["cellphonenumber"])) {         $cellphone_numbererr = "لطفا شماره موبایل خود را وارد نمایید";         $anyerror=1;}     else          $cellphonenumber = test_input($_post["cellphonenumber"]);       if (empty($_post["zipcode"])) {         $zipcodeerr = "لطفا شماره موبایل خود را وارد نمایید";         $anyerror=1;}     else          $zipcode = test_input($_post["zipcode"]);      if ( $anyerror == 0 ) {              $sql = "insert myusers6 (username,password,fname,lname,phonenumber,cellphonenumber,email,state,address,zipcode) values ('$username' ,'$password', '$fname', '$lname', '$phonenumber', '$cellphonenumber', '$email', '$state', '$address', '$zipcode')";            }          if ($conn->query($sql) === false)              echo "error: " . $sql . "<br>" . $conn->error;         else             echo "ssssssss";      }      function test_input($data) {         $data = trim($data);         $data = stripslashes($data);         $data = htmlspecialchars($data);         return $data;     }       ?> 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -