PDA

View Full Version : Display user information onscreen using forms



DFORMS
02 Aug 2010, 08:40 PM
Would anyone be able to explain to me how to keep user information, obtained using forms, displayed onscreen for future visits?

Here is my code :


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

<script language="javascript">
function getInfo(){

var info_1 = document.forms[0].user_name.value;
var info_2 = document.forms[0].user_email.value;
var info_3 = document.skynet.user_color.value;

document.getElementById('show_info_1').innerHTML = info_1;
document.getElementById('show_info_2').innerHTML = info_2;
document.bgColor = info_3;

}
</script>

<body>
<center>
<form name="skynet">
<table border="1">
<tr>
<td>
<p>Prénom : </p>
</td>
<td>
<input type="text" name="user_name" size="25px">
</td>
</tr>
<tr>
<td>
<p>Famille : </p>
</td>
<td>
<input type="text" name="user_email" size="25px">
</td>
</tr>
<tr>
<td>
<p>Couleur Préférée : </p>
</td>
<td>
<input type="text" name="user_color" size="25px">
</td>
</tr>

<tr>
<td>
&nbsp;
</td>
<td>
<input type="button" value="Envoyer" onClick="getInfo(this.form)">
<input type="reset" value="Annuler">
</td>
</tr>

<tr>
<td>
<br /><br /><br /><br />
</td>
<td>
<br /><br /><br /><br />
</td>
<tr>
<td>
<p>Votre prénom : </p>
</td>
<td>
<p id="show_info_1"></p>

</td>
</tr>
<tr>
<td>
<p>Nom de famille : </p>
</td>
<td>
<p id="show_info_2"></p>

</td>
</tr>
</table>
</form>
</center>

</body>
</html>

I want to keep the information displayed and the background color for every visit. Can i achieve this without using php?

Thank you for support!

DFORMS
02 Aug 2010, 08:58 PM
I found a working example of what i wanted. Its called témoin in french. It creates cookies and then calls them back, pretty cool stuff.