【问题标题】:Sending form data发送表单数据
【发布时间】:2014-11-17 21:54:40
【问题描述】:

我的网站上有以下联系表,但我不知道如何使用。

<form id="contact-form">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="name">
                                Name</label>
                            <input type="text" class="form-control" id="name" placeholder="Enter name" required />
                        </div>
                        <div class="form-group">
                            <label for="email">
                                Email Address</label>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span>
                                </span>
                                <input type="email" class="form-control" id="email" placeholder="Enter email" required /></div>
                        </div>
                        <div class="form-group">
                            <label for="subject">
                                Subject</label>
                            <select id="subject" name="subject" class="form-control" required="required">
                                <option value="na" selected="">Choose One:</option>
                                <option value="service">General Service</option>
                                <option value="suggestions">opt 1</option>
                                <option value="suggestions">opt 2</option>
                                <option value="suggestions">opt 3</option>
                                <option value="suggestions">opt 4</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="name">
                                Message</label>
                            <textarea name="message" id="message" class="form-control" rows="9" cols="25" required
                                placeholder="Message"></textarea>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <button type="submit" class="btn btn-skin pull-right" id="btnContactUs">
                            Send Message</button>
                    </div>
                </div>
                </form>

【问题讨论】:

  • 有什么问题?到目前为止,您尝试了什么?
  • "i have the folloing contact form on my website but not sure how to make it work "是什么意思
  • 为我工作:jsfiddle.net/k084kojg
  • “让它工作”是指将条目插入数据库还是作为电子邮件发送?
  • 您可能需要一些服务器端处理。你意识到了吗?如果是这样,您正在使用或可以使用什么?

标签: html forms contact


【解决方案1】:

您可能正在做两件事。处理同一页面上的数据(考虑到您的数据,可能性很小)或将其发送到服务器进行处理。将表单发送到服务器端可以这样完成:

1.将数据“POST”到服务器上运行的 PHP 脚本。参考这个 Sending Retrieving form data

  1. 使用 Javascript 将表单发送到服务器端 PHP 脚本。参考这个链接 Sending Forms through Javascript

我认为您没有在服务器端使用任何 PHP 脚本。也可能没有 Javascript 函数调用来将此数据发送到服务器。 有关将表单数据发送到服务器的非常基本的教程,请参阅此链接 Basic Form Handling

【讨论】:

    猜你喜欢
    • 2016-03-02
    • 2022-01-11
    • 1970-01-01
    • 1970-01-01
    • 2016-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-24
    相关资源
    最近更新 更多