Hey,
I've got my code to post a javascript array in a form:
<form id="my_form" action="file:///C:/Users/John/Desktop/jquery/savetext.aspx" method="post" onsubmit="return prepare()">
<input type="text" id="file_name" name="file_name" rows="1" cols="20" />
<input type="hidden" name="seatsArray" />
<input type="submit" value="Save" />
</form>
<script type="text/javascript">
function prepare();
{
document.getElementById('seatsArray').value = seatsArray.join();
return true;
}
</script>
Can anyone help me out with the savetext.aspx action file that I need, as my knowledge of ASP.NET is minimal (I'm used to PHP, but this one needs to be ASP.NET).
I guess I can have a crack at getting somewhere near:
<%@ Page Language="C#" %>
<script runat="server">
using System;
using System.IO;
class Test
{
public static void Main()
{
string path = "file:///C:/Users/John/Desktop/jquery/txtfiles/" + request.form("file_name");
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(request.form("seatsArray"));
sw.WriteLine("");
}
}
using (StreamReader sr = File.OpenText(path))
{
string s = "";
while ((s = sr.ReadLine()) != null)
{
Console.WriteLine(s);
}
}
}
}
</script>
Am I on the right track?
Many Thanks!