If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Session Variable

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-19-07, 13:47
mustish1 mustish1 is offline
Registered User
 
Join Date: Jul 2006
Posts: 149
Session Variable

Hi: I delete the files/cookies and clear history from the IE 6.0 browser and try to write in a text file use FSO but it dont write any thing in the file needs help

Thanks.

vote_input.asp
<form method="post" action="vote.asp">

<p><input type="radio" value="A" name="u_input">A<br>
<input type="radio" value="B" name="u_input" >B<br>
<input type="radio" value="C" name="u_input">C<br>
<input type="radio" value="D" name="u_input">D<br>
<input type="submit" value="Submit" ></p>
</form>

vote.asp
<%
on error resume next
u_input=request.form("u_input") %>

<% set fso = createobject("scripting.filesystemobject")
if session("voted_before") = "" then
session("voted_before") = "Yes"
' reads and adds a one to the selected value
g_selected="vote_count"& u_input &".txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter = clng(act.readline)
counter = counter + 1
act.close
Set act = fso.CreateTextFile(server.mappath(g_selected), true)
act.WriteLine(counter)
act.Close
end if
%>



<%
g_selected="vote_counta.txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter_a = clng(act.readline)

%>



<%
g_selected="vote_countb.txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter_b = clng(act.readline)

%>



<%
g_selected="vote_countc.txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter_c = clng(act.readline)

%>


<%
g_selected="vote_countd.txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter_d = clng(act.readline)

%>


<% total=counter_a+counter_b+counter_c+counter_d
%><br>


<br>
A&nbsp;<img src="images/red.jpg" height="12" width="<%= (counter_a/total)*100 %>"><%= formatnumber((counter_a/total)*100,1) %>%<br>
B&nbsp;<img src="images/red.jpg" height="12" width="<%= (counter_b/total)*100 %>"><%= formatnumber((counter_b/total)*100,1) %>%<br>
C&nbsp;<img src="images/red.jpg" height="12" width="<%= (counter_c/total)*100 %>"><%= formatnumber((counter_c/total)*100,1) %>%<br>
D&nbsp;<img src="images/red.jpg" height="12" width="<%= (counter_d/total)*100 %>"><%= formatnumber((counter_d/total)*100,1) %>%<br>
Total Votes: <%= total %>
Reply With Quote
  #2 (permalink)  
Old 08-19-07, 17:19
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
If you remove the "on error resume next" what line of the script fails?
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On