我正在做的网站是一个全屏滑块,有4个不同的面板.
第四个面板包含一个php联系表单.当我提交表单时,它会从第一个滑块重新加载页面,因此用户无法使用表单查看第四个面板中的结果(发送的消息或任何错误).
有什么方法可以让提交按钮也重定向到包含表单的div?
这是基本标记,使用的是php脚本:
<div id="container">
<div id="div1">
<div class="content">...</div>
</div>
<div id="div2">
<div class="content">...</div>
</div>
<div id="div3">
<div class="content">...</div>
</div>
<div id="div4">
<div class="content">
<form method="post" action="index.php">
<label>Nom</label>
<input class="small" name="name" placeholder="Name">
<label>Email</label>
<input class="small" name="email" type="email" placeholder="Email">
<label>Message</label>
<textarea class="small" name="message" placeholder="Message"></textarea>
<label>What's the best burger ever (antispam)</label>
<input class="small" name="human" placeholder="type the right answer">
<input id="submit" name="submit" type="submit" value="send">
</form>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: ...';
$to = 'johndoe@gmail.com'; …Run Code Online (Sandbox Code Playgroud) 你好!我只是想知道我刚刚创建的这个contactform脚本有多安全?很久以前,当我制作我的联系表时,我的老师正在唠叨我.
if($_SERVER['REQUEST_METHOD'] === 'POST'){
$myemail = "email@adress.com";
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$subject = $_POST['subject'];
$comments = $_POST['comments'];
if($name == 0 || !preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email) || !preg_match("/^\d{2}(-\d{3}){2}(\d{2})?$/", $phone) || $subject == 0 || $comments == 0){
$error_message = 'Something was written wrong..';
} else {
$message = "Hello!
Your contact form has been submitted by:
Name: $name
E-mail: $email
Phone: $phone
Comments: $comments
End of message";
mail($myemail, $subject, $message);
$error_message = 'Your message was sent!';
} …Run Code Online (Sandbox Code Playgroud) 我有一个字段在单击时运行JQuery脚本.这是一个表单中的字段.
但是,如果字段被选中,我需要运行脚本,因为有些用户喜欢这样做.
这是我目前的脚本
Query(function($){
$('span.website input.url').one("click", function() {
$('span.website input.url').val($('span.website input.url').val() + 'http://');})
});
Run Code Online (Sandbox Code Playgroud)
我怎样才能改变这个字段的标签?
万分感谢!
我的联系表格中有很多字段,我希望收到的电子邮件中不显示空白字段.
有没有办法在邮件正文中添加php代码(wordpress> admin>联系表单)?任何指针都会非常有用.
我已添加了Shopify文档中描述的基本联系表单.
我的代码:
{% form 'contact' %}
{% if form.posted_successfully? %}
<div class="successForm feedback">
<p>Thanks for contacting us. We'll get back to you as soon as possible.</p>
</div>
{% endif %}
{% if form.errors %}
<div class="errorForm feedback">
<p>Sorry, we were unable to submit your inquiry because it contained {{ form.errors | size | pluralize: 'an error', 'a few errors' }}.<br/>Please correct the following and submit again:</p>
{% for field in form.errors %}
<p><strong>The {{ field | capitalize | …Run Code Online (Sandbox Code Playgroud) 我知道这个问题已被多次询问,但是,我似乎无法找到与我的情况相关的解决方案,因为它们主要处理wordpress.
这是我的邮件表格:
<?php
$to = "email@gmail.com" ;
$from = $_REQUEST['email'] ;
$name = $_REQUEST['name'] ;
$headers = "From: $from";
$subject = "Contact Submission From domain.com";
$fields = array();
$fields{"name"} = "name";
$fields{"title"} = "title";
$fields{"email"} = "email";
$fields{"phone"} = "phone";
$fields{"prefer_phone"} = "pref_phone";
$fields{"prefer_email"} = "pref_email";
$fields{"message"} = "message";
$fields{"referral"} = "referral";
$body = "Here is their submitted message:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n\n",$b,$_REQUEST[$a]); }
if($from == '') {print "You have not entered an email, please …Run Code Online (Sandbox Code Playgroud) 如何通过表单 ID 将所有“联系表单 7”字段作为对象获取?
有一个函数是谁做的?我是否需要获取帖子的内容并使用正则表达式进行处理?
谢谢。
编辑:
我有一个使用 HTML/PHP 的联系表单。我希望用户能够从下拉菜单中选择一个部门,并将电子邮件发送到该部门的电子邮件地址。
我的问题是:我在 PHP 中的哪个位置指定根据用户下拉列表选择将信息发送到哪个电子邮件地址。我假设它来自这部分代码:
超文本标记语言
<label class="custom-select">
<select name="department">
<option>Technical Issues</option>
<option>Charities</option>
<option>General Inquiries</option>
<option>Other</option>
</select><span><!-- fake select handler --></span>
</label>
</div>
<div class="column-100">
<textarea name="message" placeholder="Type your message here..."></textarea>
</div>
<div class="column-100 center">
<input type="submit" value="Send" data-error="Fix errors" data-processing="Sending..." data-success="Thank you!">
</div>
<footer class="notification-box"></footer>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
PHP
define('FROM_EMAIL', '');
// Recipient's e-mail. To this e-mail messages will be sent.
// e.g.: john@example.com
// multiple recipients e.g.: john@example.com, andy@example.com
define('TO_EMAIL', 'info@beetheswarm.com');
/**
* Function for sending …Run Code Online (Sandbox Code Playgroud) 我正在为我的客户做一些网络开发,我遇到了障碍.
**这是发生了什么:**
- 我们在我们的网站上有多个相同联系表格的副本,但我们希望每个人在完成后重定向到不同的目标网页,以便跟踪转化率.
- 在这个例子中,我正在处理about页面.当用户提交他们的更多信息请求时,理想情况下该页面将重定向到唯一的感谢页面(例如,www.sample.com/thank-you-webs.html); 然而,事实并非如此.
- 电子邮件将被完美发送,但重定向将永远不会发生.没有错误抛出 - 没有.
在我展示代码之前,这是我为了自己解决它而尝试过的:
- 我在表单发送输入的.php代码下面创建了一段HTML代码.据我所知,没有重定向,所以我显然还没有看到它.
- 我使用了呼叫"Header(位置:www.sample.com/thank-you-about.html)",但这也没有做任何事情.
- 我尝试过使用Javascript的"frame.location"方法,它似乎没有比php尝试更进一步.
- 我已经将源页面和目标页面保存为.php页面,因为使用.html扩展名是问题的根源; 同样的结果.
真的,我唯一能想到的是连接类型不满足Header()调用的要求.但是不会输出错误信息吗?
这是有问题的联系表格:
<form id="contactForm" class="get-in-touch contact-form light" action="thank-you-about.php" method="post">
<input type="hidden" id="contact_nonce" name="contact_nonce" value="68592e213c"/><input type="hidden" name="" value="/"/>
<input type="hidden" name="contact-form-value" value="1"/>
<div class="iconic-input">
<input class="name" type="text" name="name" placeholder="Name*">
<i class="icons icon-user-1"></i>
</div>
<div class="iconic-input">
<input class="email" type="text" name="email" placeholder="Email*">
<i class="icons icon-email"></i>
</div>
<textarea class="msg" name="msg" placeholder="Message"></textarea>
<input type="submit" value="Send Message">
<div class="iconic-button">
<input type="reset" value="Clear">
<i class="icons …Run Code Online (Sandbox Code Playgroud) 我对PHP编码知之甚少.我有这个联系表格:
<div id="content">
<h1> Contact me </h1>
<form action=" " method="post" autocomplete="on">
<p> <label for="username" class="iconic user" > Name <span class="required">*</span></label> <input type="text" name="username" id="username" required="required" placeholder="Hi friend, how may I call you ?" /> </p>
<p> <label for="usermail" class="iconic mail-alt"> E-mail address <span class="required">*</span></label> <input type="email" name="usermail" id="usermail" placeholder="I promise I hate spam as much as you do" required="required" /> </p>
<p> <label for="usersite" class="iconic link"> Website </label> <input type="url" name="usersite" id="usersite" placeholder="eg: http://www.miste.com" /> </p>
<p> <label …Run Code Online (Sandbox Code Playgroud) 可能重复:
不推荐使用函数eregi()
我已经用PHP创建了一个联系表单,但是我收到了警告:
不推荐使用:函数eregi()在第9行的D:\ hosting\9606426\html\Websites\LuxeBeauty\1\contact.php中已弃用
这是第9行:
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-
z]{2,}"."$",$email )){
...
}
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能解决这个问题?
contact-form ×12
php ×9
html ×4
email ×2
javascript ×2
jquery ×2
redirect ×2
wordpress ×2
anchor ×1
contact ×1
form-data ×1
form-fields ×1
form-submit ×1
shopify ×1
slider ×1
web ×1