2014-02-22 62 views
0

我正在使用groundworkcss並創建一個簡單的html表單。但是當我提交表單時,生成的URL只是「file:// C://MyFiles//results.html?」Html表單GET不添加參數到URL

字段txtName的值不會添加到URL中。 最小非工作代碼如下所示。

<html class="no-js"><!--<![endif]--> 
    <head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> 
    <title>Test &hearts; Test Information</title> 
    <!-- Modernizr --> 
    <script src="../js/libs/modernizr-2.6.2.min.js"></script> 
    <!-- jQuery--> 
    <script type="text/javascript" src="../js/libs/jquery-1.10.2.min.js"></script> 
    <!-- framework css --><!--[if gt IE 9]><!--> 
    <link type="text/css" rel="stylesheet" href="../css/groundwork.css"><!--<![endif]--><!--[if lte IE 9]> 
    <link type="text/css" rel="stylesheet" href="../css/groundwork-core.css"> 
    <link type="text/css" rel="stylesheet" href="../css/groundwork-type.css"> 
    <link type="text/css" rel="stylesheet" href="../css/groundwork-ui.css"> 
    <link type="text/css" rel="stylesheet" href="../css/groundwork-anim.css"> 
    <link type="text/css" rel="stylesheet" href="../css/groundwork-ie.css"><![endif]--> 
    <style type="text/css"> 
     .logo { 
     position: relative; 
     top: -0.5em; 
     } 
     .logo a, .logo a:visited { 
     text-decoration: none; 
     color: #2B2B2D; 
     } 
     .logo img { 
     height: 2em; 
     position: relative; 
     top: 0.55em; 
     margin-right: 0.3em; 
     } 

    </style> 
    <!-- snippet (syntax highlighting for code examples)--> 
    <script type="text/javascript" src="../js/demo/jquery.snippet.min.js"></script> 
    <link type="text/css" rel="stylesheet" href="../css/demo/jquery.snippet.css"><script type="text/javascript"> 
(function() { 

    $(document).ready(function() { 
    $('pre[data-lang="html"]').snippet("html", { 
     style: "groundwork", 
     clipboard: "../js/demo/ZeroClipboard.swf" 
    }); 
    $('pre[data-lang="css"]').snippet("css", { 
     style: "groundwork", 
     clipboard: "../js/demo/ZeroClipboard.swf" 
    }); 
    $('pre[data-lang="sass"]').snippet("sass", { 
     style: "groundwork", 
     clipboard: "../js/demo/ZeroClipboard.swf" 
    }); 
    return $('pre[data-lang="js"]').snippet("javascript", { 
     style: "groundwork", 
     clipboard: "../js/demo/ZeroClipboard.swf" 
    }); 
    }); 

}).call(this); 
</script> 
    </head> 
    <body> 

    <form action="results.html" method="get"> 
         <fieldset> 




            <label for="name">Name </label> 
            <input id="txtNane" type="text" placeholder = "Enter your Name"> 

            <br> 
            <hr> 
            <button id = "btnSubmit" type="submit"> Submit </button> 

           </fieldset></form> 
    <!-- javascript--> 
    <script type="text/javascript" src="../js/groundwork.all.js"></script> 
    <!-- google analytics--> 

    </body> 
</html> 

回答

4

我想你應該給它一個名稱屬性。例如:

<input id="txtNane" type="text" placeholder = "Enter your Name" name="input_name"> 

它是如此,因爲它是應該出現這樣的:

url.domain/page.php?input_name=input_value 
在PHP

而且你訪問它是這樣的:

$_GET['input_name']