Hi, i’m working on a simple website to register items, but I got some code that just doesn’t work whatever I try.
“`
<!DOCTYPE html>
<html>
<head>
<script>
function WriteToFile(passForm)
{
var fso = CreateObject(“Scripting.FileSystemObject”);
var s = fso.CreateTextFile(“/voorraad.txt”, True);
var p = document.getElementById(‘product’);
var a = document.getElementById(‘aantal’);
var d = new Date(year, month, day, hours, minutes, seconds);
s.writeline(d);
s.writeline(p);
s.writeline(“Aantal: ” + a);
s.writeline(“—————————–“);
s.Close();
}
</script>
</head>
<body>
<form onSubmit=”WriteToFile(this)”>
<label>Product: </label>
<input type=”text” name=”product” id=”product” size=”20″>
<br>
<label>Aantal: </label>
<input type=”text” name=”aantal” id=”aantal” size=”20″>
<input type=”submit” value=”submit”>
</form>
</body>
</html>
When I click on the submit button, the website reloads with /?product=test&aantal=test2 at the end of the url (I wrote test and test2 in the textboxes. Does anyone see what I’m doing wrong here? Or am I missing some things? The textfile is on the right location but it’s always empty whatever I try…