cancel
Showing results for 
Search instead for 
Did you mean: 
New

data not inserting into table in the database but works perfectly offline

Hi my database is not allowing form insertion

below is my form and code

 

<?php
require("connection.php");
if(isset($_POST['add'])){

 $memberidz = time();
 $membersidx  = $memberidz;
$name = $_POST['name'];
$payid = $_POST['payid'];
$fee = $_POST['fee'];
$phone= $_POST['phone'];
$pdate= $_POST['pdate'];
$method= $_POST['method'];
$message= $_POST['message'];
$date = date('Y-').date('m-').date('d');  
$month = date('m');
$year = date('Y');
  //Email information

 
 $sq = "select *from paymentdata where phone= '$phone' and pdate = '$pdate' ";
 $res = mysql_query($sq);
 $array  = mysql_fetch_array($res);
 $num = mysql_num_rows($res);
 
 if($num>0){
 $msg = "Hello $name!, Sorry the system detected that you have submitted your payment details previously! ";
 
 
 }else{
 
 
        
 $sql = "insert into paymentdata(`name`,`payid`,`fee`,`phone`,`method`,`pdate`,`message`,`month`,`year`,`date`)
        VALUES('".mysql_real_escape_string($name)."','".mysql_real_escape_string($payid)."','".mysql_real_escape_string($fee)."','".mysql_real_escape_string($phone)."','".mysql_real_escape_string($method)."','".mysql_real_escape_string($pdate)."','".mysql_real_escape_string($message)."','".mysql_real_escape_string($month)."','$year','$date')";
        $result = mysql_query($sql);
        if($result){
        $msg = "$name, we have recieved your details and we will get  back to you soon, Thanks!";
 
 
 //  $send =  mail($admin_email, "$name", $service, "From:" . $phone);
 
 }else{
 
 $msg  = "wait";
 }
 
 }
}



?>

<?php include("header.php"); ?>
    <!--END NAV SECTION -->
    <!-- SERVICES SECTION -->
    <div class="section">
        <div class="container">


            <div class="row main-low-margin">
                <div class="col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1">
                   
                </div>
            </div>


        </div>
    </div>

    <div class="container">
        <div class="row main-low-margin text-center">
            <div class="col-md-4 col-sm-4">
                
            </div>
            <div class="col-md-4 col-sm-4">
                
            </div>
            <div class="col-md-4 col-sm-4">
                
            </div>

        </div>
        <div class="row main-low-margin ">

            <div class="col-md-8 col-sm-8">
                <p>        

      
                    <h2 class="sectionTitle">VERIFY YOUR PAYMENT DETAILS (please enter details you used to pay as it appears in the payment you made.</h2>
                        <div align="center"><?php echo $msg; ?></div>
                </div>
          <form  method="POST" >
                        <div class="row form-group">
                          <div class="col-xs-6">
                            <input type="text" name="name" placeholder="ENTER DEPOSITOR'S NAME " id="name" class="form-control" required/>
                          </div>
                          <div class="col-xs-6">
                            <input type="text" name="payid" placeholder="ENTER TRANSACTION ID E.G: Payment id" id = "payid" class="form-control " required/>
                          </div><br/> <div class="col-xs-6">
                            <input type="text" name="phone" placeholder="ENTER PHONE NUMBER" id = "phone" class="form-control" required/>
                          </div>
                          <div class="col-xs-6">
                            <input type="text" name="pdate" placeholder="ENTER DATE PAID EG: YEAR-MM-DD" id="pdate" class="form-control " required/>
                          </div><br/><div class="col-xs-6">
                          <input type="text" name="fee" placeholder="ENTER AMOUNT PAID" id="fee" class="form-control " required/>     </div>
                          <div class="col-xs-6">
            <input type="text" name="method" placeholder="ENTER PAYMENT METHOD" id="method" class="form-control " required/>
                          </div><br/>
                          
                        </div>
                          
                             <div class="col-xs-6">
                           <input type="text" name="message" placeholder="message" id="message" class="form-control " required/>
                          </div><br/><br/>
                          
                        <button type="submit" name="add" class="btn btn-primary">REGISTER</button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="reset" class="btn btn-primary">Cancel</button>
                       <span class="form-message" style="display: none;"></span>
                      </form>
                </p>
            </div>

            <div class="col-md-4 col-sm-4 text-center">
         
            </div>
        </div>


    </div>
    <div class="space-bottom"></div>
    <!--END SERVICES SECTION -->
    <!--FOOTER SECTION -->

    <?php include("footer.php"); ?>

2 REPLIES 2

Re: data not inserting into table in the database but works perfectly offline

i have same problam

New

Re: data not inserting into table in the database but works perfectly offline

i'm having the same problem.

if solution is found, please do care to contact me with the email below:

coloredigit@gmail.com