1

私は HTML にかなり慣れていないため、この問題を理解するのに苦労しています。

ユーザーがメールアドレスを入力できるこのフォームがあり、送信するとWebサイトに登録されます。

別のフォームの値として入力した電子メール アドレスの値を取得するにはどうすればよいでしょうか?

これが私が取り組んでいるものです。任意のヒント?:

<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="...

submit イベントで、2 つの電子メール入力を取得します。

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

...そして値を設定します:

targetInput.value = sourceInput.value;

私は上記をテストしませんでしたが、あなたが探していることを行うべきだと思います。の代わりにid使用できるように、2 つの入力にも s を指定した方がよい場合があります。getElementByIdgetElementsByName

編集:

上記は、入力とフォームの両方が同じページにあり、ページが更新されていない場合にのみ機能します。質問に基づいて、私はそれが事実であると仮定しています。上記では、メールが正常に保存されたかどうかも確認していません (繰り返しますが、メールをコピーする前に確認する必要があるかどうかはわかりません)。

于 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

セッションを使用する

ページ 1:

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

2ページ目:

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