- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个网站,用户可以在其中发布他想出售的任何东西,其他人可以看到它并向他发送消息。我正在使用 while 循环从数据库中检索信息。我的问题是,我的每个帖子都有一个联系按钮,当有人点击它时,它会打开一个对话框,用户可以在其中填写消息,表格会将其发送到卖家的电子邮件地址。我对如何将特定卖家的电子邮件从数据库分配到该特定商品列表感到困惑。
这是我现在的代码
while($row=mysql_fetch_array($eleclisting))
{ ?>
<div align="center">
<font size="6" color="4684fd"><? echo $row['title']; ?></font><br>
<? $selleremail=array($row['email']); ?>
<font size="3" color="908282"><? echo addslashes($row['description']); ?></font><br>
<font size="3"><? echo "Price: $".$row['price']; ?></font>
<a id="contactpopup" href="#"><button type="button" name="contactbutton"
id="contactbutton" value="">contact</button></a>
<hr>
<? } ?>
下面是有人点击联系按钮时的表单
<div id="contact" class="contact" style="width:600px;border:#fff medium solid; top:50%;
margin-top:-120px; display:none; height:300px; z-index:1001; position:fixed; left:50%;
margin-left:-250px; background:#ebebeb; overflow:auto;">
<form action="listingcontact.php" method="POST">
Message
<br><textarea name="message" style="min-width:500px; max-width:500px; max-height:200px;
min-height:200px;"></textarea> <br>
Email <input type="email" name="contactemail" id="contactemail" style="min-width:250px;
max-width:250px; min-height:25px; max-height:25px;"><br><br><input type="submit"
value="send"> <button type="button" id="cancel">close</button>
</form>
</div>
如果代码令人困惑,我们深表歉意。提前致谢!
最佳答案
您只需在联系人弹出链接中添加属性data-email
,如下所示:
<a id="contactpopup" class="opencontactpopup" href="#" data-email="<?php echo $row['email'];?>">....</a>
然后在您的表单中添加一个隐藏字段来保存电子邮件 ID,例如:
<form action="listingcontact.php" method="POST">
<input type="hidden" name="tomail" id="tomail" value="">
//your remaining code
</form>
单击弹出链接时,将相应的电子邮件添加到隐藏字段,如下所示:
<script>
$('.opencontactpopup').click(function(){
var tomail = $(this).attr('data-email');
$('#tomail').val(tomail);
//your remaining code
})
</script>
现在,提交表单时,您可以从字段 $_POST['tomail']
获取电子邮件 ID。希望对你有帮助。但这不是公开使用电子邮件 ID 的正确方法。
关于php - 如何在 while 循环中为每个表单分配电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21746848/
我正在尝试从如下所示的变量中提取一些内容: v1 ","person 2 ") (该变量有数百个观察值) 我想最终创建第二个变量来提取他们的电子邮件以提供以下输出: v2 ","person 2 ")
当您添加 facebook 连接以允许 facebook 用户登录您的站点时,您可以取消用户名和电子邮件地址吗? 最佳答案 是的,您需要先提示他们“电子邮件”数据权限。 Facebook 也在很快改变
我们正在寻求建立一个专门用于商业/商业用途的新网站。我们只需要允许“企业”电子邮件地址注册。因此,使用 Gmail、Hotmail、Yahoo 等的用户无法使用这些电子邮件地址申请。 除了创建 gma
我想通过Identity内的Claim访问我的电子邮件地址 我尝试访问为: var email = User.Identity.GetClaimsByType("emailaddress").ToSt
我正在使用 Hammock 库和 C# 从以下帖子中的链接获取用户的基本配置文件和电子邮件地址 here . 我也关注了这些帖子 here和 here 然而,对于我来说,我无法获得 linkedin
我正在使用 Hammock 库和 C# 从以下帖子中的链接获取用户的基本配置文件和电子邮件地址 here . 我也关注了这些帖子 here和 here 然而,对于我来说,我无法获得 linkedin
我正在尝试制作一个应用程序,通过获取 json 编码数组来从 SQL 数据库获取数据。 它获取地址数据和其他类型的数据,然后将其传递给 Mapkit map View 元素和一些标签/ TextVie
当使用钥匙串(keychain)和证书助手从现有 CA 申请证书时,所有说明都说我应该单击“保存到磁盘”选项,并且不需要“CA 电子邮件地址”。 我看到的面板没有提供“保存到磁盘”选项,当我尝试在没有
我的问题不在于我无法将电子邮件保存到数据库中。任何人都可以做到。这是我的问题: 当用户在我的网站上创建帐户时,他们会获得 ID、用户、密码和电子邮件地址数据。对于密码,我对其进行哈希处理,这样如果有人
我想向非 ASCII 电子邮件地址发送电子邮件,但我不确定使用 JDK8 的推荐程序是什么。 我应该如何处理以下电子邮件地址? Dörte@example.com test@Sörensen.de D
我想阻止用户: 从第一个文本框复制粘贴到第二个 右键单击并使用上下文菜单将第一个文本框复制并粘贴到第二个文本框。 这是行不通的。 Confirm email page
我正在使用两个不同的 Git 存储库(即 github 和 stash),我想为每个存储库使用不同的电子邮件地址。我知道我可以使用 git config 但我不想每次创建新工作区时都必须记住这样做。所
类似于this question ,但不确定在这种情况下如何实现。 受信任的用户(不需要关心验证输入)正在将电子邮件地址键入/粘贴到文本字段中。在模糊事件中,我想查看文本并清理他输入的任何内容(通常是
我正在使用以下代码使用 VBA 发送电子邮件。但是,没有发送电子邮件......我认为这是由于 '.To = ' 代码行中有多个电子邮件地址。有没有办法调整代码以允许多个电子邮件地址? 我试过看 Ro
我正在尝试制作一个脚本,该脚本将在整个网页中搜索以@xyz.com 结尾的电子邮件地址。例如: $(document).ready(function() { $("body:contains(
我们正在使用Office 365,并且遇到了创建重复帐户的问题。这会导致在用户地址上添加数字(john.doe@c0mpany.onmicrosoft.com也将是john.doe5826@c0mpa
我的类型是用户:电子邮件和用户名。 电子邮件字段设置为字符串类型,并使用自定义分析器“exact_lower”: index.analysis.analyzer.exact_lower: type
这个问题已经有答案了: Delete a specific user from Firebase (6 个回答) 已关闭 3 年前。 我正在建立一个网站,其中某个“管理员”用户可以删除任何其他用户的帐
我已经完成 Facebook 登录,但我不知道如何获取电子邮件地址并以其他形式显示它 所以,这就是代码 private void nextActivity(Profile profile){
我有一个付费应用程序,安装后用户可以使用购买该应用程序的电子邮件地址进行注册。 我想知道这个电子邮件地址是否从Google Play购买了我的应用(验证),否则拒绝其注册。有什么办法(API)? 最佳
我是一名优秀的程序员,十分优秀!