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=”
<Table align=”center”>
<tr>
<td valign=”top” align=”right”> <b>Please Enter your Name: </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: </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: </b> </td>
<td> <input type=”text” name=”Subject” size=”50″/> </td>
</tr>
<tr>
<td valign=”top” align=”right”> <b>Comments: </b> </td>
<td> <textarea rows=”14″ name=”Message” cols=”50″></textarea> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<input type=”hidden” name=”To_Email” value=”
<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>