php - The information from the form is not sending to the database -


it echoing other page not sending database. there php page connect database.so took off connection database in php page got alot of errors.

this code:

<?php     require 'login.php';          $path = 'img/';         if (isset($_post['submit'])) {         // grab image post array         $fn = isset($_post['fname']) ? $_post['fname'] : '';         $ln = isset($_post['lname']) ? $_post['lname'] : '';         $sex = isset($_post['sex']) ? $_post['sex'] : '';         $city = isset($_post['city']) ? $_post['city'] : '';         $em = isset($_post['email']) ? $_post['email'] : '';         $pass = isset($_post['pword']) ? $_post['pword'] : '';         $confirm = isset($_post['cword']) ? $_post['cword'] : '';          //$gend = $_post['gender']; not using         $pic = $_files['pic']['name'];         if (!empty($fn) && !empty($ln) && !empty($pic)) {          // move file target upload folder         $target = $path.$pic;//create image source (src)         if (move_uploaded_file($_files['pic']['tmp_name'], $target)) {           // // connect database         $dbase = mysqli_connect('localhost', 'root', '', 'flowers');         //write data database         $my_query = "insert members values ('$fn', '$ln', '$sex','$city','$em','$pass', '$pic');";           mysqli_query($dbase, $my_query);            // confirm success user          echo '<p>thank registering us!</p>';          echo '<p><strong>name:</strong> ' . $fn .' '.$ln .'<br />';          echo '<img src="' . $path . $pic . '" alt="profile image" /></p>';          echo '<p><a href="index.html">&lt;&lt; return home page</a></p>';         }         }         } 

form code:

<div id="formcontrol">                 <form id="form" action="img_upload.php"  method="post" onsubmit="return validateform(); "enctype="multipart/form-data">                     <fieldset>                         <legend>personal information</legend>                              <label> first name: </label> <br/>                             <input type="text" id="fname" name="fname"/> <br/>                             <span id="f_error"></span><br/><br/>                          <label>last name </label><br/>                             <input type="text" name="lname" id="lname"/><br/><br/>                             <span id="l_error"></span><br/>                          <label> sex: </label><br/>                             male <input type="radio" id="msex" name="sex" value="male"/>                             female <input type="radio" id="fsex" name="sex" value="female"/> <br/> <br/> <br/>                           <label>city: </label>                             <select>                                     <option value="" selected="selected" name="city" id="add">select city</option>                                 <option value="sando">san fernando</option>                                 <option value="pos">port of spain</option>                                 <option value="chag">chaguanas</option>                                 <option value="arima">arima</option>                                 <option value="bella">marabella.</option>                                 <option value="point">point fortin</option>                                 <option value="puna">tunapuna</option>                                 <option value="scarborough">scarborough</option>                              </select>                             <span id="ad_error"></span><br/><br/>                         </fieldset>                          <fieldset>                         <legend>register</legend>                          <label>email address</label><br/>                             <input type="text" id="email" name="email"/><br/><br/>                             <span id="em_error"></span><br/><br/>                          <label> password: </label><br/>                             <input type="password" id="pword" name="pword"/> <br/> <br/>                             <span id="p_error"></span><br/><br/>                          <label>confirm password: </label><br/>                             <input type="password" id="cword" name="cword"/> <br/> <br/>                              <span id="c_error"></span><br/>                          <label>profile picture: </label><br/>                            <input type="file" name="pic" id = "pic" /><br/> <br/> <br/>                          <input type="submit" name="submit" value="submit"/>                         <input type="reset" value="reset"/>                       </fieldset>                  </form>              </div> 

please check $dbase link after connect database. after check error code. can echo sql query know sending database , valuate that, copy , execute in direct in mysql database


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 -