[英]Adding php fields into email
So i have a FancyForm pre-made form that has only session post name, email, and message. 因此,我有一个FancyForm预制表单,仅包含会话帖子名称,电子邮件和消息。 If i add more fields for the user to complete, how do i get what he typed into the email being sent to me from the form?
如果我添加更多字段供用户填写,我如何获取他在表单中发送给我的电子邮件中键入的内容? Here's what i'm talking about:
这就是我在说的:
<form id="contact-form" name="contact-form" method="post" action="submit.php">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="15%"><label for="name">Name</label></td>
<td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="<?=$_SESSION['post']['name']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td><label for="email">Email</label></td>
<td><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td>
<td> </td>
</tr>
<tr>
<td width="15%"><label for="length">Telephone</label></td>
<td width="70%"><input type="text" class="validate[required,custom[onlyNumber]]" name="telephone" id="telephone" value="<?=$_SESSION['post']['telephone']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td><label for="subject">Subject</label></td>
<td><select name="subject" id="subject">
<option value="" selected="selected"> - Choose -</option>
<option value="Residential Job">Residential Job</option>
<option value="Commercial Job">Commercial Job</option>
<option value="Repair">Repair/Patch</option>
<option value="Complaint">Complaint</option>
<option value="Question">Question</option>
</select></td>
<td> </td>
</tr>
<tr>
<td valign="top"><label for="message">Message</label></td>
<td><textarea name="message" id="message" class="validate[required]" cols="35" rows="5"><?=$_SESSION['post']['message']?></textarea></td>
<td valign="top"> </td>
</tr>
<tr>
<td><label for="captcha"><?=$_SESSION['n1']?> + <?=$_SESSION['n2']?> =</label></td>
<td><input type="text" class="validate[required,custom[onlyNumber]]" name="captcha" id="captcha" /></td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
<td colspan="2"><input type="submit" name="button" id="button" value="Submit" />
<?=$str?> <img id="loading" src="img/ajax-load.gif" width="16" height="16" alt="loading" /></td>
</tr>
</table>
</form>
The premade form had the name and email address fields already there, so they're working 100%. 预制表单已经有名称和电子邮件地址字段,因此它们可以100%使用。 I added my own 'telephone' session post, but when i complete the form and email it to myself, only the name/email fields send.
我添加了自己的“电话”会话帖子,但是当我填写完表格并将其通过电子邮件发送给自己时,仅发送名称/电子邮件字段。 What am i missing?
我想念什么?
The site: contact form 网站: 联系表格
The premade form: fancyform 预制形式: 花式
JSFiddle: submit.php 的jsfiddle: submit.php
JSFiddle: validationEngine.js JSFiddle: validationEngine.js
Please, i'd love to get this sorted! 拜托,我很想把这个排序!
Thanks, Corey 谢谢,科里
This is the php i call before html on the contact.php page: 这是我在contact.php页面上的html之前调用的php:
<?php
session_name("fancyform");
session_start();
$_SESSION['n1'] = rand(1,20);
$_SESSION['n2'] = rand(1,20);
$_SESSION['expect'] = $_SESSION['n1']+$_SESSION['n2'];
$str='';
if($_SESSION['errStr'])
{
$str='<div class="error">'.$_SESSION['errStr'].'</div>';
unset($_SESSION['errStr']);
}
$success='';
if($_SESSION['sent'])
{
$success='<h1>Success! We will be in contact!</h1>';
$css='<style type="text/css">#contact-form{display:none;}</style>';
unset($_SESSION['sent']);
}
?>
Simply by adding the new post session ids into the submit.php form i was able to solve this. 只需将新的发布会话ID添加到Submit.php表单中,我就能解决此问题。 Quite simple actually.
其实很简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.