我无法提交此表格

时间:2015-01-18 08:29:58

标签: php html

我的代码中的问题,当我按下提交时它没有提交,虽然我检查了语法100次并更改了它的要求。我认为这里的问题不起作用可能是提交原因

我的HTML代码:

<!DOCTYPE HTML>

<html>
<head>
    <title>forms</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.dropotron.min.js"></script>
    <script src="js/skel.min.js"></script>
    <script src="js/skel-layers.min.js"></script>
    <script src="js/init.js"></script>
    <noscript>
        <link rel="stylesheet" href="css/skel.css" />
        <link rel="stylesheet" href="css/style.css" />
        <link rel="stylesheet" href="css/style-desktop.css" />
    </noscript>
    <!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" />
<![endif]-->
    <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=PT+Sans:400,700'>
    <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Oleo+Script:400,700'>
    <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/style.css">



    <style type="text/css">
      body, html {
          height: absolute;
          margin: 0;
          -webkit-font-smoothing: antialiased;
          font-weight: 100;


          font-family: helvetica;
      }

      .tabs input[type=radio] {
          position: relative;
          top: -9999px;
          left: -9999px;
      }
      .tabs {
        width: 650px;
        float: none;
        list-style: none;
        position: relative;
        padding: 0;
        margin: 75px auto;
      }
      .tabs li{
        float: left;
      }
      .tabs label {
          display: block;
          padding: 10px 20px;
          border-radius: 2px 2px 0 0;
          color: #14AA1E;
          font-size: 24px;
          font-weight: normal;
          font-family: 'Oleo Script', serif;
          background: #D4D3D3;
          cursor: pointer;
          position: relative;
          top: 3px;
          -webkit-transition: all 0.2s ease-in-out;
          -moz-transition: all 0.2s ease-in-out;
          -o-transition: all 0.2s ease-in-out;
          transition: all 0.2s ease-in-out;
      }
      .tabs label:hover {
        background: rgba(255,255,255,0.5);
        top: 0;
      }

      [id^=tab]:checked + label {
        background: #f7f7f7;
        color: black;
        top: 0;
      }

      [id^=tab]:checked ~ [id^=tab-content], [id^=tab]:checked ~ [id^=tab-content] > div {
          display: block;
      }
      .tab-content{
        z-index: 2;
        display: none;
        text-align: center;
        overflow: hidden;
        width: 100%;
        font-size: 20px;
        line-height: 140%;
        padding-top: 10px;
        background-color:       #f7f7f7;
        background-image:       -moz-linear-gradient(top, rgba(0,0,0,0.05), rgba(0,0,0,0)),     url('images/bg01.png');
        background-image:       -webkit-linear-gradient(top, rgba(0,0,0,0.05), rgba(0,0,0,0)),  url('images/bg01.png');
        background-image:       -o-linear-gradient(top, rgba(0,0,0,0.05), rgba(0,0,0,0)),       url('images/bg01.png');
        background-image:       -ms-linear-gradient(top, rgba(0,0,0,0.05), rgba(0,0,0,0)),      url('images/bg01.png');
        background-image:       linear-gradient(top, rgba(0,0,0,0.05), rgba(0,0,0,0)),          url('images/bg01.png');
        background-position:    top left,                                                       top left;
        background-repeat:      repeat-x,                                                       repeat;
        background-size:        100% 30em,                                                      auto;
        padding: 15px;
        color: black;
        position: relative;
        top: 53px;
        left: 0;
        box-sizing: border-box;
      }
      .tab-content div{
        display: none;
        -webkit-animation-duration: 1s;
        -o-animation-duration: 1s;
        -moz-animation-duration: 1s;
        animation-duration: 1s;
      }
      .chbox form input {
        width: 10px;
        height: 30px;
        background: #fcfcfc;
        border: 1px solid #ddd;
        -moz-border-radius: 2px;
        -webkit-border-radius: 2px;
        border-radius: 2px;
        -moz-box-shadow: 0 1px 3px 0 rgba(0,0,0,.1) inset;
        -webkit-box-shadow: 0 1px 3px 0 rgba(0,0,0,.1) inset;
        box-shadow: 0 1px 3px 0 rgba(0,0,0,.1) inset;
        font-family: 'PT Sans', Helvetica, Arial, sans-serif;
        color: #888;
        font-size: 16px;
      }
    </style>
</head>
<body class="no-sidebar">

    <!-- Header -->
        <div id="header-wrapper">
            <header id="header" class="container">

                <!-- Logo -->
                    <div id="logo">
                        <h1><a href="index.html">HAC</a></h1>
                        <span>Humanitarian Aid Commission</span>
                    </div>

                <!-- Nav -->
                    <nav id="nav">
                        <ul>

                            <li  class="current"><a href="ProjectsForm.html">T.A Form</a></li>
                            <li><a href="right-sidebar.html">Home</a></li>
                        </ul>
                    </nav>


            </header>
        </div>

    <!-- Main -->


                            <!-- Content -->
                    <div class="main">

                            <div class="register span6">

                            <form action="" method="post">
                                <!--button 1-->
                                <button type="button" action = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">Step One</button>
                            <div id="light" class="white_content">
                                    <h2>Basic Info <span class="red"><strong>STEP 1</strong></span></h2>
                                    <div id="D1">
                                        <label for="p_name">Project Name</label>
                                        <input type="text" id="firstname" name="p_name" >
                                        <label for="p_loc">Location</label>
                                        <input type="text" id="lastname" name="p_loc" >
                                        <label for="p_desc">Project Description</label>
                                        <input type="text" id="username" name="p_desc" >
                                        <label for="Goals">Project Goals</label>
                                        <input type="text" id="email" name="Goals" >                               


                                    </div>
                                    <div id="D2">
                                        <label for="stdate">start date</label>
                                        <input type="date" name="stdate">
                                         <label for="enddate">end date</label>
                                         <input type="date" name="enddate">
                                         <label for="input_exp">inputs Expenses</label>
                                         <input type="number" id="inputsExpenses" name="input_exp" >
                                        <label for="Operating_exp">Operating expenses</label>
                                         <input type="number" id="Operatingexpenses" name="Operating_exp" >


                                    </div>
                                    <!--<label for="password">Password</label>
                                    <input type="password" id="password" name="password" placeholder="choose a password..."> -->
                                   <button type="button" action = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Go to Step two</button>
                             </div>
                        <div id="fade" class="black_overlay"></div>

                                                        <!--button 2-->
                    <button type="button" action = "javascript:void(0)" onclick = "document.getElementById('light1').style.display='block';document.getElementById('fade1').style.display='block'">Step two</button>
                        <div id="light1" class="white_content">
                            <table>

                                 <tr><td colspan="2">
                                    <h2>staffing</h2></td>

                                 </tr>
                                <tr>
                                     <td><label for="sd_staff">number of Sudanese staff</label></td>
                                     <td><input type="number" id="sd_staff" name="sd_staff" ></td>

                                 </tr>
                                 <tr>
                                     <td><label for="int_staff">number of internationals staff: </label></td>
                                     <td><input type="number" id="int_staff" name="int_staff" ></td>

                                 </tr>
                                 <tr>
                                    <td colspan="2">
                                    <h2>Partners</h2> </td>

                                 </tr>

                                <tr>
                                     <td><label>NGOs Partners</label></td>
                                     <td><input type="checkbox"   value="1" name="ch1"></td>
                                </tr>
                                <tr>
                                     <td><label>Governmental partners</label></td>
                                     <td><input type="checkbox" class="chbox" value="2" name="ch2"></td>
                                </tr>
                                <tr>
                                    <td><label>COBs organization</label></td>
                                    <td><input type="checkbox"  class="chbox" value="3" name="ch3"></td>
                                </tr>
                                <tr>
                                     <td><label>others</label></td>
                                     <td><input type="checkbox" value="4"  class="chbox" name="ch4"></td>
                                </tr>

                                <tr><td colspan="2">
                                    <h3>beneficiaries :</h3>
                                    </td>

                                </tr>


                                <tr>
                                     <td><label>children</label></td>
                                     <td><input type="checkbox"   value="1" name="ch11"></td>
                                </tr>
                                <tr>
                                     <td><label>Women</label></td>
                                     <td><input type="checkbox" class="chbox" value="2" name="ch22"></td>
                                </tr>
                                <tr>
                                    <td><label>Old men</label></td>
                                    <td><input type="checkbox"  class="chbox" value="3" name="ch33"></td>
                                </tr>
                                <tr>
                                     <td><label>Refugees</label></td>
                                     <td><input type="checkbox" value="4"  class="chbox" name="ch44"></td>
                                </tr>

                                <tr>
                                     <td><label>disabled</label></td>
                                     <td><input type="checkbox" value="4"  class="chbox" name="ch55"></td>
                                </tr>

                                <tr><td rowspan="2">
                                        <button type="button" action = "javascript:void(0)" onclick = "document.getElementById('light1').style.display='none';document.getElementById('fade1').style.display='none'">Go to Step three</button>

                                    </td>
                                </tr>
                            </table>
                        </div>

                                <div id="fade1" class="black_overlay"></div>

                                                    <!--button 3-->
                    <button type="button" action = "javascript:void(0)" onclick = "document.getElementById('light2').style.display='block';document.getElementById('fade2').style.display='block'">Step three</button>
                       <div id="light2" class="white_content">
                                <h2>Basic Info <span class="red"><strong>STEP 3</strong></span></h2>
                                <div id="D1">
                                    <p>Submit this form now
                                    </p>                           


                                </div>

                               <input type="submit" action = "TASubmit.php" >Submit</input>
                          </div>
                                 <div id="fade2" class="black_overlay"></div>
                            </form>
                            </div>
                    </div>




    <!-- Footer -->
        <div id="footer-wrapper">
            <footer id="footer" class="container">


                <div class="row">
                    <div class="12u">
                        <div id="copyright">
                            <ul class="menu">
                                <li>&copy; Website. All rights reserved</li><li>Design: <a href="#">Computer Science </a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </footer>
        </div>
        <!-- Javascript -->

    <script src="assets/bootstrap/js/bootstrap.min.js"></script>

    <script src="assets/js/scripts.js"></script>

</body>
</html>

这是我的PHP之一:

<?php
$servername = "localhost";
$username = "root";
$password = "mkmbhs";
$dbname = "HACsys";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error )) {
die("connect error({$conn->connect_errno}) {$conn->connect_error}")


$p_name = mysql_real_escape_string($_POST['p_name']);
$p_loc = mysql_real_escape_string($_POST['p_loc']);
$p_desc = mysql_real_escape_string($_POST['p_desc'])
$Goals = mysql_real_escape_string($_POST['Goals'])
$stdate = mysql_real_escape_string($_POST['stdate'])
$enddate = mysql_real_escape_string($_POST['enddate'])
$input_exp = mysql_real_escape_string($_POST['input_exp'])
$Operating_exp = mysql_real_escape_string($_POST['Operating_exp'])
$sd_staff = mysql_real_escape_string($_POST['sd_staff'])
$int_staff = mysql_real_escape_string($_POST['int_staff'])
$ch1 = mysql_real_escape_string($_POST['ch1'])
$ch2 = mysql_real_escape_string($_POST['ch2'])
$ch3 = mysql_real_escape_string($_POST['ch3'])
$ch4 = mysql_real_escape_string($_POST['ch4'])
$ch11 = mysql_real_escape_string($_POST['ch11'])
$ch33 = mysql_real_escape_string($_POST['ch33'])
$ch44 = mysql_real_escape_string($_POST['ch44'])
$ch55 = mysql_real_escape_string($_POST['ch55'])
$Budget = $input_exp + $Operating_exp ;

$sql = "INSERT INTO hac_emp (proj_name,Location,Start _date,End_date,General_goals,Budget,inputs_expenses ,Operating_expenses,NGO_Partners,CBOs_Partners,Govern_Partners,other_Partners,Sd_emp,int_emp, p_desc)
VALUES         ('$p_name','$p_loc',$stdate,$enddate,'$Goals',$Budget,$input_exp,$Operating_exp,$ch1,$ch3,$ch2,$ch4,$sd_staff,$int_staff,'$p_desc')";
$result = mysql_query($sql);
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";} 
else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);}


mysqli_close($conn);
?>

2 个答案:

答案 0 :(得分:2)

似乎错过了必须处理标签中的表单的页面网址。

<form action="myphppage.php" method="post">

您应该在action属性中写入目标网址

答案 1 :(得分:1)

是的,试试:

<form action="TASubmit.php" method="post">

..你可以删除&#34;动作&#34;来自提交按钮的属性。

相关问题