2014-01-17 6 views
0

안녕하세요. 벽돌 벽에 부딪혔을 때 도움을 구하고 있습니다. HTML 파일의 내용을 받아 텍스트 파일에 쓰는 간단한 ASP 코드가 있습니다 (아래 참조). 파일에 문자열을 쓸 수 있으며 모든 것이 잘 작동합니다. 폼에서 필드 중 하나를 쓰려고 할 때 문제가 발생합니다.asp를 사용하여 텍스트 파일에 변수 작성하기

나는 파일이 생성되고 워드에 파일에 쓰여진 것을 볼 수 있습니다. 또한 이메일 주소가 화면에 표시되어 데이터가 파일로 전달되는지 확인할 수 있습니다.

답변

0

중 첫 번째 행에서 변수 sEmailAddress을 사용하거나 다음에 마지막 줄을 수정 :

outputFile.WriteLine(request.form("IEmailAddress")) 

하지

outputFile.WriteLine(request.form("sEmailAddress")) 

(당신이 outputFile.WriteLine에 오타가 (으로 Request.Form ("sEmailAddress")))

+0

감사합니다. 나는 잘못 입력했다. 나는 당신이 말하고 있었던 것에서 코드를 두 번 체크했으나 여전히 운이 없다. – user3206555

0

텍스트 파일을 읽고 텍스트 영역에 텍스트 내용을 넣는 비슷한 작업을하고있었습니다. 사용자는 거기에 있던 내용을 업데이트하고 "업데이트"를 클릭하면 텍스트 영역에서 모든 새 정보를 가져옵니다. 당신이하려고하는 것이지 모르지만 내 코드는 아래에 있습니다. 희망이 도움이됩니다.

업데이트 페이지 :

<!-- Opens/Creates the file Notifications.txt--> 
     <% 

      Set cs=Server.CreateObject("Scripting.FileSystemObject") 
      Set c=cs.OpenTextFile(Server.MapPath("Notifications.txt"), 1) 
      theGoods = (c.ReadAll) 

      c.Close 

      Set f=Nothing 
      Set fs=Nothing 


     %> 
    <!-- /End the file Notifications.txt--> 
     <form method="GET" action="overwrite.asp"> 

      <textarea rows="10" cols="100" name="Updates" id="Notifications" required><%= theGoods%></textarea> 
      <br /><br /> 
      <input type="submit" name="submit" value="Update" id="submit" onclick="toggle_visibility('Update');"/> 
      <input type="button" value="Bold Tags" id="bold" /> 
      <input type="button" value="Italic Tags" id="italic" /> 
     </form> 

실제 처리/덮어 쓰기 페이지 : 나에게 다시 얻기를위한

<!-- Opens/Creates the file Notifications.txt--> 
     <% 
     Dim idea 

     dim fs,f 

     set fs=Server.CreateObject("Scripting.FileSystemObject") 
     set f=fs.OpenTextFile(Server.MapPath("Notifications.txt"), 2, true) 

     idea= Request.QueryString("Updates") 


     f.WriteLine(idea) 
     f.Close 
     set f=nothing 
     set fs=nothing 

     %>