User form to be saved in a .txt file

I wanted to create a similiar thing to a feedback area on a flash site that saves the info to a .txt file or e-mails it (that would be hard i htink).

could someone post a tute?

Hey kruza,

Well, both would need a server-side script to work, if u would like to save ur information into txt, a php or any other language is a must, or u would like to send the information into ur email, it would be the same! so please tell me which would u need!?

yours,
h88

PS. you should have a php enabled host to use those features!

yeh i have a php enabled host so either php or .txt file

php would be better i guess…thanks a lot!

Hi kruza,

I meant that if you want to save to a .txt, you should have a php script to save your information into txt, and if you want to send your information to your email, you’ll need also php!

So i want you to choose weather saving to a .txt using php OR sending the information to your email!

yours,
h88

saving to .txt using php would do fine!

thanks again

the php e-mail form would acually bu much much easier… what you need to do is set it up so that each text box is saved as a variable… then you have it send an email with the variables inside the e-mail… i’ll type up a code for you and post it here but i g2g now

give me a little bit…

sorry for the delay… here is the script…

well, a php code that sends an email will look like:

<?
$recipient = "email@msn.com";
unset($HTTP_POST_VARS['onLoad']);
unset($HTTP_POST_VARS['clear']);
$body = "The following information was submitted...

";
foreach($HTTP_POST_VARS as $key => $value) {
	$key = substr($key, 0, -4);
	$body .= "$key: $value
";
}
$from = $HTTP_POST_VARS['name_txt'] . " <" . $HTTP_POST_VARS['email_txt'] . ">";
mail($recipient, $HTTP_POST_VARS['subject_txt'], $body, "From: $from");
?>

OMG! sorry it keeps acually making the stupid form… how do i pist it so its just the code? lol

nvm… looks like he beat me to it…lol

and in flash:

// Create data handler and set onLoad event handler
dataHandler = new LoadVars();
dataHandler.onLoad = function(success) {
	if (success) {
		messageBox("Your data has been mailed by the server. Thank you for your feedback, and someone will be in touch with you shortly regarding your query");
	} else {
		messageBox("You data was not able to be sent due to a problem on the server. Please try again later!");
	}
}
dataHandler.sendAndLoad("simplemailer.php", dataHandler, "POST");

hope this helps!

yours,
h88

Please check the attached fla, and upload it into ur server, and tell me how it goes!

yours,
h88

the previous one would’nt work, that one would!

yours,
h88

sorry, forgot to attach :o

Description for what did i do:

User will enter his name and address, the name and address will be in the form of:

“name - address”, debug the code to suits u!

yours,
h88