PHP代码不起作用。没有错误

时间:2017-03-14 19:53:07

标签: php html forms

我有这个系统,我可以在其中添加新记录和编辑。像记录保存系统的东西。它运作顺利。我已多次测试它以确保它按计划正常工作。但是会有这个实例它不会起作用。我甚至没有碰过这些代码。我有备份文件,它正在工作。但在将其覆盖到旧的(假定为已损坏)文件后,它仍然无法运行。没有错误,只是运作不好。这是一个

editprocess-service.php

<?php
  include('check.php'); 
?>

<!DOCTYPE html>
<html>
<head>
    <title>Samson</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="css/frame2.css">
    <link rel="stylesheet" type="text/css" href="css/nav6.css">
    <link rel="stylesheet" type="text/css" href="css/textbox.css">
<style>
    .myTable { 
        background-color:#eee;
        border-collapse:collapse;
        margin-left: auto;
        margin-right: auto;
    }
    .myTable th {
        background-color:#407cb9;
        color:white;
        width:;
    }
    .myTable td, .myTable th {
        padding:5px;
        border:1px solid #000;
                }
    .myTable a{
        text-decoration: none;
        color: red;
        position: center;
    }
    body{
    background-image: url(images/bg.png);
    background-size: 100% 100%;
    background-origin: content-box;
  }
</style>
<body style="background-image: url(images/loginbg2.jpg); background-repeat: no-repeat; background-size: 100%;">

<!--Nav-->
<ul>
  <img src="images/logowhite.png" style="margin-left: -728px;">
  <!--style="margin-left: -728px;">-->
  <li style="margin-left: 200px;"><a href="home.php">Home</a></li>
  <li><a class="active">Fill-Up Form</a></li>
  <li><a href="clist.php">Customer List</a></li>
  <li><a href="filem.php">File Maintenance</a></li>
  <li style="float: right"><a href="logout.php">Logout</a></li>
    <!--<li style="margin-right: 100px;"><a href="#"> Logout </a></li>-->
</ul>



<div id="container"></div>
<div id="content">
 <br><br>


<?php
    include('connect-db.php');
        if(isset($_GET['CustomerNumber']))
        {
            $CustomerNumber=$_GET['CustomerNumber'];
            if(isset($_POST['submit']))
            {

                $crc_no = $_POST['crc_no'];
                $date_of_service = $_POST['date_of_service'];
                $date_of_interment = $_POST['date_of_interment'];
                $authorized_family = $_POST['authorized_family'];
                $rel_to_deceased = $_POST['rel_to_deceased'];
                $rel_address = $_POST['rel_address'];
                $service_phone_no = $_POST['service_phone_no'];
                $service_deceased = $_POST['service_deceased'];
                $service_type = $_POST['service_type'];
                $service_amount = $_POST['service_amount'];
                $less_service = $_POST['less_service'];
                $net_amount = $_POST['net_amount'];

                $query3=mysql_query("UPDATE records SET crc_no='$crc_no', date_of_service='$date_of_service', date_of_interment='$date_of_interment', authorized_family='$authorized_family', rel_to_deceased='$rel_to_deceased', rel_address='$rel_address', service_phone_no='$service_phone_no', service_deceased='$service_deceased', rel_address='$rel_address', service_phone_no='$service_phone_no', service_deceased='$service_deceased', service_type='$service_type', service_amount='$service_amount', less_service='$less_service', net_amount='$net_amount' WHERE CustomerNumber='$CustomerNumber'");
                if($query3)
                {
                header('location: fill.php');
                }
                }
                $query1=mysql_query("SELECT * FROM records where CustomerNumber='$CustomerNumber'");
                $query2=mysql_fetch_array($query1);
                ?>
            <!--andy -->


<?php
                    include ('connect-db.php');
                    if(isset($_POST['btn_submit'])){
                    $sql = "SELECT records SET
                    CRC = '".$_POST['CRC']."',
                    Name = '".$_POST['Name']."',

                    where CustomerNumber = '".$_POST['CustomerNumber']."'";

                    if(mysqli_query($con, $sql)){
                        header('location:home.php');
                    }else{
                        echo "Error ".mysqli_error($con);
                    }

                }
                $CRC ='';

                if(isset($_GET['CustomerNumber'])){
                    $sql = "SELECT * FROM records WHERE CustomerNumber=".$_GET['CustomerNumber'];
                    $result = mysql_query($sql);
                    if(mysql_num_rows($result) > 0){
                        $row = mysql_fetch_assoc($result);
                        $CustomerNumber = $row['CustomerNumber'];
                        $CRC = $row['CRC'];
                        $Name = $row['Name'];




                    }
                }   
            ?>  


            <!--endocrine glands-->

                <form method="post" action="">

                <table style="width: 10%;">


 <p style="font-size: 30px; font-family: Verdana;"> &nbsp Service Contract </p>
  <hr style="margin-top: -20px; width: 95%;">

<p style="margin-left: 700px;">CRC No: <?=$CRC?>
 <br></p>

<p style="margin-left: 700px;">Date of Service: <input type="text" name="date_of_service" value="<?php echo $query2['date_of_service']; ?>" />
</p>

<p style="margin-left: 700px;">Date of Internment:  <input type="text" name="date_of_interment" value="<?php echo $query2['date_of_interment']; ?>" />
<br></p>

<p style="margin-left: 50px;">Name of Authorized<br>Family Representative:  <input type="text" name="authorized_family" value="<?php echo $query2['authorized_family']; ?>" />
<br></p>

<p style="margin-left: 50px;">Relation to Deceased: <input type="text" name="rel_to_deceased" value="<?php echo $query2['rel_to_deceased']; ?>" />
<br></p>

<p style="margin-left: 50px;">Address: <input type="text" name="rel_address" value="<?php echo $query2['rel_address']; ?>" />
<br></p>

<p style="margin-left: 50px;">Phone No:  <input type="text" name="service_phone_no" value="<?php echo $query2['service_phone_no']; ?>" />
<br></p>

<p style="margin-left: 50px;">Name of Deceased:  <?=$Name?>
<br><br>




<p style="margin-left: 50px;">
Type of Service:  
<input type="radio" name="service_type" value="Sunny Star">Sunny Star</button>
<input type="radio" name="service_type" value="Lemon Tropic">Lemon Tropic</button>
<input type="radio" name="service_type">White Fairy</button><br> 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<input type="radio" name="service_type">Chinese Holy</button>
<input type="radio" name="service_type">Red Ginger</button>
<input type="radio" name="service_type">Blue Days</button>
</p>

 &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 

<!--value="<?php // echo $query2['service_type']; ?>"-->



<p style="margin-left: 50px;">Amount:   <input type="text" name="service_amount" value="<?php echo $query2['service_amount']; ?>" />
  </p>

<p style="margin-left: 410px;">  Less:  <input type="text" name="less_service" value="<?php echo $query2['less_service']; ?>" />
<br></p><br><br>

<p style="margin-left: 410px;">  NET AMOUNT: 
<br></p>

<p style="margin-left: 50px;">LESS: PAYMENTS<br></p>
<table style="border: 1px gray solid; margin-left: 50px;">

<th>Date</th>
<th>O.R.#</th>
<th>Amount</th>
<th>Balance</th>

<tr>
<td><input type="text" name="less_date_service"></td>
<td><input type="text" name="or_serivce"></td>
<td><input type="text" name="less_amount_service_"></td>
<td><input type="text" name="balance_service"></td><br>
</tr>

<tr>
<td><input type="text" name="less_date_service_2"></td>
<td><input type="text" name="or_serivce_2"></td>
<td><input type="text" name="amount_service_2"></td>
<td><input type="text" name="balance_service_2"></td><br>
</tr>
</table><br><br><br>

  <button onclick="myFunction()" name="Submit" style="margin-left: 650px; height: 50px; width: 150px;">Submit</button>

<button type="submit" name="back" onclick="goBack()" style="margin-left: 10px; height: 50px; width: 150px;">Back</button>

<a href="masterlist.php"><button type="reset" value="Reset" style="margin-left: 10px; height: 50px; width: 150px;">Reset</button></a>

<script>
function goBack() {
    window.history.back();
}
</script>

</form>
                <?php
                    }
                ?>
<br>
</div>
</body>
</html>

谢谢!

0 个答案:

没有答案