This is a discussion on "Saving contact form information when submit is pressed?" within the JavaScript Forum section. This forum, and the thread "Saving contact form information when submit is pressed? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Saving contact form information when submit is pressed?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Saving contact form information when submit is pressed?
I would like to use java to save what the user inputs into a contac us form to a text file as opposed to having the data mailed via na email address.
I would prefer to use javascript to do this? Does anyone have any ideas on it ? I am quite new to java so i hope it is simple. I cannt find anything on the web. any help would be awesome. |
|
|
|
|||
|
Re: Saving contact form information when submit is pressed?
I'm not sure that would be the best idea.
JavaScript is vulnerable to attack, You'd be better of use a server side language such as PHP or ASP. They are quite easy to learn. Although, if you would really like to use JS. Have a look at this: http://4umi.com/web/javascript/filewrite.htm Or just google, JavaScript - Writing files. |
|
|||
|
Re: Saving contact form information when submit is pressed?
I'm not quite sure what you want to do.
Do you want to save contact data on the server? That can't be done with JavaScript. You need a server side language for this. You could use PHP to save a file on the server instead of emailing the data to you. Also note: JavaScript is not Java. They are two completely different languages used for different purposes. |
|
|||
|
Re: Saving contact form information when submit is pressed?
No no
all i need to know is what code i can put behind a submit button to save the form data the user enters to a text file as opposed to using a mailto I have something written here but it seems very long winded. |
|
|||
|
Re: Saving contact form information when submit is pressed?
There is no simple code that you can use to save a file. It is usually done on the server using PHP or similar.
But you can view a JavaScript code here: http://4umi.com/web/javascript/filewrite.htm#thescript The problem is it only works in Internet Explorer. |
|
|||
|
Re: Saving contact form information when submit is pressed?
Ok, I get it. You want to save the details in a textfile instead of having them mailed to some emailed address.
Instead of adding it to a MySQL database, you want to add it to a textfile so that the file is human readble. Correct? Is this what you want?
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
|
|
||||
|
Re: Saving contact form information when submit is pressed?
As blake121 says there is no way to do this with cross-compatible javascript. ActiveX (bad choice of programming) has some functions for manipulating local files but the security of end users has prevented this being anything other than closet code for niche purposes.
What you really want to look into is ajax -- which is javascript communicating with a server-side language such as PHP. You can use PHP to write the text file and store on the server ( or serve as download to user as required)
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: Saving contact form information when submit is pressed?
I think he want both of them (email and text file)
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|||
|
Re: Saving contact form information when submit is pressed?
This is the PHP script you would need to do it. Remember, this is PHP not javascript.
Just create a HTML form and point it towards this script. The rest would be taken care by the PHP script
The are used to produce tab spaces so that you can read conveniently.
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
Last edited by RohanShenoy; Dec 13th, 2007 at 07:22. |
|
|||
|
Re: Saving contact form information when submit is pressed?
Again this is a job for server side languages. This is because end users can manipulate javascript as it is ran in there browsers plus the fact javascript cant do this by definition becuase its a client side scripting language so your snookered anyway.
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] PHP contact form redirect to same form | Posie | PHP Forum | 14 | Jan 29th, 2008 20:28 |
| submit many forms - auto submit the same form many times | divs | JavaScript Forum | 0 | May 24th, 2007 10:10 |
| Submit information field | escaflowne11 | Starting Out | 1 | Feb 14th, 2007 12:52 |
| Need Quote Form and Contact Form | Av8er | Flash & Multimedia Forum | 5 | Oct 30th, 2003 17:14 |