简体   繁体   English

制作表格以传递参数

[英]Make a form to pass parameters

I've a form but it doesn't pass the parameters 'url' and 'USERNAME' to the next page. 我有一个表单,但是它没有将参数“ url”和“ USERNAME”传递给下一页。 Is there something wrong? 有什么不对?

I must use <button> instead of <input> for styling issues. 我必须使用<button>而不是<input>来解决样式问题。

Here is the form: 形式如下:

<form action="/confirmation/index.php" method="post" class="form-wrap">
<div class="loader-wrap">
<div class="loader-txt">
</div>
</div>

<div class="field-set url-field">
<input type="text" name="url" data-placeholder="Your Website URL" maxlength="50" class="validate">. 
<button name="url_btn" type="button" class="btn url-btn">Scan My Site!</button>
</div>

<div class="field-set email-field">
<input type="text" name="USERNAME" data-placeholder="Your E-mail" maxlength="50" class="validate">
<button name="email_btn" type="button" class="btn email-btn" style="width:174px;font-size:15px;">Send me Results!</button>
</div>
</form>

email_btn should be of type="submit" instead of type="button", so rather: email_btn的类型应该为“提交”,而不是类型为“按钮”,因此:

<button type="submit">Send me the results</button>

see here: 看这里:

http://www.w3schools.com/tags/tag_button.asp http://www.w3schools.com/tags/tag_button.asp

This should work with a submit Button! 这应该与一个提交按钮一起使用!

(The extra php is to show that it works!) (额外的php是为了表明它有效!)

<?php

if (isset($_POST['submitted'])) {
    echo "form submitted";
}
?>

<form action="index.php" method="post" class="form-wrap">
    <div class="loader-wrap">
        <div class="loader-txt">
        </div>
    </div>

    <div class="field-set url-field">
        <input type="text" name="url" data-placeholder="Your Website URL" maxlength="50" class="validate">. 
        <button name="url_btn" type="button" class="btn url-btn">Scan My Site!</button>
    </div>

    <div class="field-set email-field">
        <input type="text" name="USERNAME" data-placeholder="Your E-mail" maxlength="50" class="validate">
        <button name="email_btn" type="button" class="btn email-btn" style="width:174px;font-size:15px;">Send me Results!</button>
        <button name="submitted" type="submit">Send me the results</button> //Submit Button 
    </div>
</form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM