dpda53918 2016-04-13 13:47
浏览 45
已采纳

清理SQL / PHP并且不写。 不会选你的CSS

<!DOCTYPE html>
<html lang="en">
<head>

  <!-- Basic Page Needs
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta charset="utf-8">
  <title>Collecting Data for Database</title>
  <meta name="description" content="">
  <meta name="author" content="AleR">

  <!-- Mobile Specific Metas
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- FONT
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link href="http://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">

  <!-- CSS
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
 <link rel="stylesheet" href="normalize.css">
  <link rel="stylesheet" href="skeleton.css">
 <!--    <link rel="stylesheet" href="backbone.css"> -->

<style>
    #container{
        width:90%;
        margin: 40px auto 0 auto;
        
    }    
    h1   {color:lightgreen;}
    
</style>
  
    <style>
body {background-color:lightgreen; color: green;}
h1   {color: lightgreen;}
p    {color: lightgreen;}
        header {
            margin-top: -25px;
            margin-left: -500px;
            height: 100px;
            width: 10000px;
            background-color: green;
        }
        
        nav{background-color: green;    height: 100%;
            width: 100%;}
        aside{background-color: green;    height: 100%;
            width: 100%;}
        
        
</style>
</head>
    <header></header>
    <nav></nav>
    <aside></aside>
<body>

  <!-- Primary Page Layout
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->

<div id="container" align="center">
<form action="final.php" method="post">
  <div class="row">
    <div class="six columns">
      <label for="Age">Category</label>
      <input class="u-full-width" type="text" name="Category">
        
        <label for="Qualifications">Qualifications</label>
      <input class="u-full-width" type="text" name="Qualifications">
        
               <label for="Experience">Experience</label>
      <input class="u-full-width" type="text" name="Experience">
        

        </form>
       
    </div>
    
  </div>
   
  <form action="final.php" method="post">
  <input class="button-primary" type="submit" value="Submit">
</form>
    </div>
  
    
    
    </body>
</html>

In the first code set I am running into the normalize and skeleton css pages being recognized. Aside from this the submit button works but will not write to my databse.

PHP TO

<!DOCTYPE html>
<html lang="en">
<head>

  <!-- Basic Page Needs
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta charset="utf-8">
  <title>Audio Search</title>
  <meta name="description" content="">
  <meta name="author" content="AlexR">

  <!-- Mobile Specific Metas
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- FONT
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link href="http://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">

  <!-- CSS
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
 <link rel="stylesheet" href="normalize.css">
  <link rel="stylesheet" href="skeleton.css">
  <!--  <link rel="stylesheet" href="backbone.css"> -->
<style>
    #container{
        width:90%;
        margin: 40px auto 0 auto;
        
    }    
    
    background{
        color: green;
    }
    
    
</style>
    
    <style>
body {background-color:lightgreen;}
h1   {color:blue;}
p    {color:green;}
</style>
    
  

</head>
<body>

  <!-- Primary Page Layout
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->


    
    <div id="container">
<form>
  <div class="row">
    <div class="six columns">
      <p>Thank you for your name and e-mail.</p>
   
      <?php
        error_reporting(E_ALL);
       DEFINE('DB_USERNAME', '*****');
    DEFINE('DB_PASSWORD', '*****');
    DEFINE('DB_HOST', 'localhost');
    DEFINE('DB_DATABASE', '*****');
       
        
      echo "here!";  
        
        
        
          if (isset($_REQUEST['Experience'])){
              $Age = $_REQUEST['Age'];
              $Qualifications = $_REQUEST['Qualifications'];
              $Experience = $_REQUEST['Experience'];
            
              
              #echo "Thanks for your submission.";
            $dbc = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_DATABASE) OR die ('Could not connect to MySQL: '.mysqli_connect_error());
            $q = "INSERT INTO `FinalForm`(`Age`, `Qualifications`, `Experience`) VALUES ('$Age','$Qualifications','$Experience' )"; 
              
              $r = mysqli_query($dbc,$q);
              
              # ^^^ Search submit results window
              
              if ($r){echo "Results below";} else {echo "Your search found zero results";};
              
              
              
}
              
              
              
              
              
          
          
          
          
          
          ?>
      </form>
         </div>
      <div>  
          
      
      
 
    
  
    </div>
    
</html>

Not sure why the PHP is not running but the code seems clean to me.

PHP FROM

<!DOCTYPE html>
<html lang="en">
<head>

  <!-- Basic Page Needs
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta charset="utf-8">
  <title>Audio Shop Data Retrieval</title>
  <meta name="description" content="">
  <meta name="author" content="AlexR">

  <!-- Mobile Specific Metas
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- FONT
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link href="http://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">

  <!-- CSS
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
 <link rel="stylesheet" href="normalize.css">
  <link rel="stylesheet" href="skeleton.css">
  <!--  <link rel="stylesheet" href="backbone.css"> -->
<style>
    #container{
        width:90%;
        margin: 40px auto 0 auto;
        
    }    
    h1   {color:lightgreen;}
    
</style>
  
    <style>
body {background-color:lightgreen; color: green;}
h1   {color: lightgreen;}
p    {color: lightgreen;}
        header {
            margin-top: -25px;
            margin-left: -500px;
            height: 100px;
            width: 10000px;
            background-color: green;
        }
</style>
    
</head>
    <header><h1>Audio Supply Retrieval</h1></header>
<body>

  <!-- Primary Page Layout
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->


    
    <div id="container" align="center">
<form>
  <div class="row">
    <div class="six columns">
   
      <?php
        error_reporting(E_ALL);
       DEFINE('DB_USERNAME', 'arr07598');
    DEFINE('DB_PASSWORD', 'Minty!23');
    DEFINE('DB_HOST', 'localhost');
    DEFINE('DB_DATABASE', 'arr07598')
    
              
            $dbc = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_DATABASE) OR die ('Could not connect to MySQL: '.mysqli_connect_error());
            $q = "SELECT * FROM `FinalForm` ORDER BY `Category` ASC";
              $r=@mysqli_query($dbc,$q);
                
            if ($r) {
                echo '<table><tr><td><b>Age</b></td><td><b>Qualifications</b></td><td><b>Experience</b></td></td>';
                while($row=mysqli_fetch_array($r,MYSQLI_ASSOC)){
                    echo "<tr><td>$row[NameID]</td><td>$row[Age]</td><td>$row[Qualifications]</td><td>$row[Experience]</td></tr>";
                }
       
                echo "</select>";
                };
              echo "<p>";
               
              
              
          
          ?>
        
      </form>
         </div>
      <div>  
          
      
      
 
    
  
    </div>
    </body>
</html>

</div>
  • 写回答

1条回答 默认 最新

  • duanshang3230 2016-04-13 13:51
    关注

    Your input type submit is in another form that has only it as an input field. You'll need a submit button in your first form - the one you want to submit

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥15 统计大规模图中的完全子图问题
  • ¥15 使用LM2596制作降压电路,一个能运行,一个不能
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错