表单不会向querystring发送任何数据

mac*_*erk 3 html php forms query-string

我在这里结束了我的智慧,我很肯定这是一个荒谬的打字错误,或者我忘了写点什么.

无论如何,我试图将数据从twitter引导模式内的表单发送到一个名为'processed.php'的文件,该文件使用PHPMailer脚本.但是,当我提交表单时,没有数据传递给查询字符串,url只是更改为'/processed.php?'

如果有人能够对它有所了解,我会非常感激.

这是代码:

HTML第一:

     <div class="modal-body">
        <form id="send-msg" method="GET" action="processed.php">
            <fieldset>
                <div class="control-group">
                    <label class="control-label" for="inputNavn">Navn:</label>
                    <div class="controls">
                        <input type="text" class="input-medium required" id="inputNavn">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputTlf">Telefon nummer:</label>
                    <div class="controls">
                        <input type="text" class="input-medium required" id="inputTlf">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputMsg">Besked:</label>
                    <div class="controls">
                        <textarea class="input-large required" id="inputMsg" rows="3"></textarea>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <button type="submit" class="btn btn-primary btn-large" id="inputSend" href="#" rel="popover" data-content="Vi vender tilbage hurtigst muligt." data-original-title="Send besked" data-loading-text="Sender besked…">Send besked</button>
                    </div>
                </div>
            </fieldset>
        </form>
        <div id="results" class="alert alert-info span2">
            <p>Udfyld venligst alle felter.</p>
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

现在的PHP:

<?php

$navn= $_REQUEST['inputNavn'];
$tlf= $_REQUEST['inputTlf'];
$besked= $_REQUEST['inputMsg'];

require_once('PHPMailer/class.phpmailer.php');
...(The rest is just the PHPMailer script)

echo $navn;
?>
Run Code Online (Sandbox Code Playgroud)

无论如何,我在查询字符串中没有得到任何东西.希望可以有人帮帮我.

非常感谢提前!

det*_*lor 8

我认为你需要添加一个name属性,input以便提交值,例如

<input type="text" class="input-medium required" id="inputNavn">
Run Code Online (Sandbox Code Playgroud)

应该

<input type="text" class="input-medium required" id="inputNavn" name="inputNavn">
Run Code Online (Sandbox Code Playgroud)