/    Sign up×
Community /Pin to ProfileBookmark

Hi I have been trying to make a form so that I can have the users name and email address appear the next time they visit after they have submitted the form once. I am able to get it to do this for the name but am having serious problems getting it to work for the email. Any help would be much appreciated. My code at the moment puts the name in both the name and email fields. My code is below.

<html>
<head>
<title></title>

<SCRIPT LANGUAGE=”JavaScript”>
function setCookie(form) {
cookie_name = “bevo”
cookie_email= “bevo1”
document.cookie=cookie_name+”=”+form.inputbox1.value+”;;expires=Tuesday, 01-Apr-2004 08:00:00 GMT; path=/”;
document.cookie=cookie_email+”=”+form.From_Email.value+”;;expires=Tuesday, 01-Apr-2004 08:00:00 GMT; path=/”;
}
function read_cookie() {
var cookie_variable = document.cookie.substring(5,document.cookie.length)
document.getElementById(‘inputbox1’).value = cookie_variable
var cookie_email = document.cookie.substring(5,document.cookie.length)
document.getElementById(‘From_Email’).value = cookie_email

}
</SCRIPT>

</head>
<body onLoad=”read_cookie()” text=”#000000″ bgcolor=”#FFEFD5″>

<h1 align=”center”><b>Javascript 3 – Cookies</b></h1>

<p align=”left”>Thank You for visiting my site. Please take some time to fill out this feedback form to help us to
improve the user experience of the site.</p>

<center>
<FORM name=cookie-setter action=”http://student1.tay.ac.uk/mailrelay/form_mail.asp” Method=”POST”>

<Table align=”center”>
<tr>
<td valign=”top” align=”right”> <b>Please Enter your Name:&nbsp;</b> </td>
<td> <input type=”text” name=”inputbox1″ VALUE=”” size=”50″/> </td>
</tr>

<tr>
<td valign=”top” align=”right”> <b>Please Enter your Email Address:&nbsp;</b> </td>
<td> <input type=”text” name=”From_Email” VALUE=”” size=”50″/> </td>
</tr>

<tr>
<td valign=”top” align=”right”> <b>Please Enter a Comments Subject:&nbsp;</b> </td>
<td> <input type=”text” name=”Subject” size=”50″/> </td>
</tr>

<tr>
<td valign=”top” align=”right”> <b>Comments:&nbsp;</b> </td>
<td> <textarea rows=”14″ name=”Message” cols=”50″></textarea> </td>
</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>
<input type=”hidden” name=”To_Email” value=”[email protected]“>
<tr>
<td>
</td>
<td>
<INPUT TYPE=”submit” NAME=”button” Value=”Submit” onClick=”setCookie(this.form)”>
</td>
<td><input type=”reset” value=”Reset Message”/></td>
</tr>

</table>
</form>
</body>
</html>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@CharlesNov 14.2003 — [font=georgia]I posted, for you, a working example just two days ago. See http://forums.webdeveloper.com/showthread.php?s=&threadid=21241.[/font]
×

Success!

Help @dtennant9 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...