moose05
09-18-2005, 09:15 PM
There is probably a very easy answer to this question but I'm not too experienced in php and I havent done something like this before.
I have a simple form. One field for an email adress and a submit button. When a user enters their email address and then clicks submit I would like it to save the email to a text file and then send the user to a thank you page.
If someone could write a quick code that will do this (including the form) it would be great.
Thanks,
James.
vinyl-junkie
09-19-2005, 02:39 AM
I would like it to save the email to a text file
Here (http://www.codingforums.com/showthread.php?p=188320#post188320) is a post that tells you how to write to a file using PHP.
and then send the user to a thank you page.
Example from the PHP manual (http://www.php.net/header) :
header("Location: http://www.example.com/");
Hope this helps. :)
moose05
09-19-2005, 02:35 PM
Thank you, but I needed someone to write the full code that would do what I needed. As I said I'm not too familiar with php and I didnt know what to do with the code in that thread.
If anyone could quickly write a short code that would do what I needed, it would be great :)
Thanks.
NancyJ
09-19-2005, 02:49 PM
Thank you, but I needed someone to write the full code that would do what I needed. As I said I'm not too familiar with php and I didnt know what to do with the code in that thread.
If anyone could quickly write a short code that would do what I needed, it would be great :)
Thanks.
try posting here http://www.codingforums.com/forumdisplay.php?f=36 :p
Seriously though, have a go. All the information you need has been provided for you, if you get stuck, post what you've got and we can help you.
NickCTM
09-19-2005, 06:32 PM
$handle = fopen("filename.txt", "a");
fwrite( $handle, "\n" . $_POST['email'] );
fclose( $handle );
I'm not making any validation check and I'm not checking if the user already put his email in the file...I'm sure you can figure it out using these functions.