1

我对 HTML 相当陌生,无法解决这个问题。

我有这个表格,它允许用户输入他们的电子邮件地址,然后当他们提交它时将他们注册到网站。

我想知道如何获取他们输入的电子邮件地址的值作为另一个表单的值?

这就是我正在使用的。有小费吗?:

<form class="form" method="post" action="https://register.sendreach.com/forms/?listid=7465"><input name="lid" value="7465" type="hidden">
<div class="field"><label>Email:</label>
<input class="text" name="email" value="My best email address is..." onblur="if (this.value == '') {this.value = 'My best email address is...';}" onfocus="if (this.value == 'My best email address is...') {this.value = '';}" type="text">

<form action="http://mywebsite.com/?mode=register&amp;type=quick" method="post">
<input type="text" name="member_email" value = /></p>  **<--- Here is where I want to get the email address text used earlier in the name field called email and use it for the name field member_email. I want to use that as the value. How do I grab that?**

<input name="product_id" value="1" type="hidden">
<input name="success_url" value="aHR0cDovL2luY29tZWphY2tlci5jb20vbWVtYmVyc2hpcC1ob21lLw==" type="hidden"></div>
<input class="button small_btn" value="Get Instant Access" type="submit">
<p class="small">Download Sent To Email!</p>
</form>
4

3 回答 3

0

在提交时做一些事情(类似于你如何在焦点和模糊上做一些事情):

<form onsubmit="...

在提交事件中,获取两个电子邮件输入:

var sourceInput = document.getElementsByName('email')[0];
var targetInput = document.getElementsByName('member_email')[0];

...并设置值:

targetInput.value = sourceInput.value;

我没有测试上述内容,但我相信这应该可以满足您的需求。最好同时给出两个输入ids,因此您可以使用getElementById而不是getElementsByName.

编辑:

仅当输入和表单都在同一页面上并且页面未刷新时,上述内容才有效。基于这个问题,我假设是这样。上面也没有检查电子邮件是否保存成功(同样,我不知道这是否是您在复制电子邮件之前要检查的内容)。

于 2013-06-15T03:16:08.243 回答
-1

用这个。

<form class="form" method="post" action="https://register.sendreach.com/forms/?listid=7465"><input name="lid" value="7465" type="hidden">
<div class="field"><label>Email:</label>
<input class="text" name="email" value="My best email address is..." onblur="if (this.value == '') {this.value = 'My best email address is...';} document.getElementById('member_email').value=this.value;" onfocus="if (this.value == 'My best email address is...') {this.value = '';}" type="text">

<form action="http://mywebsite.com/?mode=register&amp;type=quick" method="post">
<input type="text" name="member_email" id="member_email"></p>  **<--- Here is where I want to get the email address text used earlier in the name field called email and use it for the name field member_email. I want to use that as the value. How do I grab that?**

<input name="product_id" value="1" type="hidden">
<input name="success_url" value="aHR0cDovL2luY29tZWphY2tlci5jb20vbWVtYmVyc2hpcC1ob21lLw==" type="hidden"></div>
<input class="button small_btn" value="Get Instant Access" type="submit">
<p class="small">Download Sent To Email!</p>
</form>

请注意,我已将 id 属性添加到您要获取电子邮件地址的输入标签中。以及标签中的一些代码,您想从中获取电子邮件地址

于 2013-06-15T02:59:03.857 回答
-1

使用会话

第一页:

<?php
session_start();
$_SESSION['email_address']=$email_variable;
?>

第二页:

<php
new_email_variable=$_SESSION['email_address'];
?>
于 2013-06-15T02:49:16.077 回答