By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,551 Members | 2,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,551 IT Pros & Developers. It's quick & easy.

Can you save form data to the website?

P: 10
In my website i have forms that are submitted into the URL and then converted into javascript on the next page, i wish to have sort of like a survey on the first page and then she the results of others on the next, is their anyway of storing javascript variables into an html file, my web hosting doesn't allow anything else and doesn't allow the post method (webs.com) If its not possible can someone explain a way to do it in notepad?

also the email form code also brings up windows live mail and the form data doesn't even appear in the message is the a way to email form data just from the website?






if it will help heres the codes for both my pages

index.htm
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head></head>
  3. <body onload="message()">
  4.  
  5. <div style="position:absolute;top:10px;left:50px" >
  6.  
  7. <form name="input" action="index2.htm" method="get">
  8. Name: <input type="text" name="user" /> <br />
  9. Age:   <input type="number" name="age" min="1" max="120" /> <br />
  10. E-mail: <input type="email" name="email" /> <br />
  11. <input type="radio" name="sex" value="male" /> Male<br />
  12. <input type="radio" name="sex" value="female" /> Female <br />
  13. <input type="checkbox" name="bike" value="Yes" /> I have a bike<br />
  14. <input type="checkbox" name="car" value="Yes" /> I have a car <br />
  15.  
  16. <input type="submit" value="Submit" />
  17.  
  18. </form>
  19.  
  20.  
  21. <noscript></noscript><!-- --><script type="text/javascript" src="http://www.freewebs.com/p.js"></script><script type="text/javascript">
  22.  
  23.  
  24.  
  25.  
  26. if (localStorage.pagecount2)
  27.     {
  28.     localStorage.pagecount2=Number(localStorage.pagecount2) +1;
  29.     }
  30. else
  31.     {
  32.     localStorage.pagecount2=1;
  33.     }
  34. document.write(<br /> + "You've been on this page " + localStorage.pagecount2 + " time(s)");
  35.  
  36.  
  37.  
  38.  
  39. </script>
  40.  
  41.  
  42.  
  43. </div>
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. </body>
  52. </html>
  53.  
index2.htm
Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3. <head>
  4. </head>
  5. <body>
  6.  
  7.  
  8.  
  9. <noscript></noscript><!-- --><script type="text/javascript" src="http://www.freewebs.com/p.js"></script><script type="text/javascript">
  10.  
  11.  
  12. function querySt(ji) {
  13. hu = window.location.search.substring(1);
  14. gy = hu.split("&");
  15. for (i=0;i<gy.length;i++) {
  16. ft = gy[i].split("=");
  17. if (ft[0] == ji) {
  18. return ft[1];
  19. }
  20. }
  21. }
  22.  
  23.  
  24.  
  25.  localStorage.sex = querySt("sex");
  26.  localStorage.car = querySt("car");
  27.  localStorage.bike = querySt("bike");
  28.  localStorage.user = querySt("user");
  29.  localStorage.age = querySt("age");
  30.  localStorage.email = querySt("email");
  31.  
  32.  
  33.  
  34.      var strReplaceAll =  localStorage.user;
  35.      var intIndexOfMatch = strReplaceAll.indexOf( "+" );
  36.  
  37.      // Loop over the string value replacing out each matching
  38.      // substring.
  39.      while (intIndexOfMatch != -1){
  40.      // Relace out the current instance.
  41.      strReplaceAll = strReplaceAll.replace( "+", " " )
  42.  
  43.      // Get the index of any next matching substring.
  44.      intIndexOfMatch = strReplaceAll.indexOf( "+" );
  45.      }
  46.  
  47.  
  48.      localStorage.user = strReplaceAll;
  49.  
  50.  
  51.  
  52.  
  53.  
  54.      var strReplaceAlla   =  localStorage.email;
  55.      var intIndexOfMatcha = strReplaceAlla.indexOf( "%40" );
  56.  
  57.      // Loop over the string value replacing out each matching
  58.      // substring.
  59.      while (intIndexOfMatcha != -1){
  60.      // Relace out the current instance.
  61.      strReplaceAlla = strReplaceAlla.replace( "%40", "@" )
  62.  
  63.      // Get the index of any next matching substring.
  64.      intIndexOfMatcha = strReplaceAlla.indexOf( "%40" );
  65.      }
  66.  
  67.  
  68.      localStorage.email = strReplaceAlla;
  69.  
  70.  
  71.  
  72.  
  73.  
  74. document.write( localStorage.user+" is "+localStorage.sex+" and "+localStorage.age+" years old. His/Her email is "+ localStorage.email);
  75.  
  76.  
  77.  
  78.  
  79.  
  80. -->
  81. </script>
  82.  
  83.  
  84.  
  85. </body>
  86. </html>
  87.  
Jan 13 '11 #1

✓ answered by AutumnsDecay

I'd change hosts, personally, especially if you're using their free package of hosting.

You can find basic PHP enabled hosting plans for like, $1/mo

Share this Question
Share on Google+
1 Reply


AutumnsDecay
100+
P: 170
I'd change hosts, personally, especially if you're using their free package of hosting.

You can find basic PHP enabled hosting plans for like, $1/mo
Jan 13 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.