View Full Version : Forms: Having the form data sent in a .txt file
slikrick87
08-02-2004, 03:48 PM
I am creating a form, and I just want everything sent to my email address in a .txt file. Does anyone know how to do that? I really need everyone's help, and I would very much appreciate it.
Thanks,
Rick
Spookster
08-02-2004, 04:17 PM
I'm sure many of us know how to do this. If you are planning on writing one then you need to ask more specific questions and provide us with code you've already started with and point out where you are stuck or what errors are occurring.
If you don't plan on writing one yourself then you will need to look around for one that is already written and has the features you want.
http://www.hotscripts.com/PHP/Scripts_and_Programs/Form_Processors/index.html
slikrick87
08-02-2004, 08:20 PM
This is the coding I've written myself so far, I just need to know how the completed form can be sent in a .txt file to my email instead of it just being bunched up in an email.
_________________________________________________________________
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>IMS Pipeline Information Form</title>
<SCRIPT LANGUAGE="JavaScript">
function verify() {
var themessage = "You are required to complete the following fields: ";
if (document.form.ProjectName.value=="") {
themessage = themessage + "Project Name";
}
if (document.form.Type.value=="") {
themessage = themessage + ", Type";
}
if (document.form.StartDate.value=="") {
themessage = themessage + ", Start Date";
}
if (document.form.EndDate.value=="") {
themessage = themessage + ", End Date";
}
if (document.form.Status.value=="") {
themessage = themessage + ", Status";
}
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
document.form.submit();
}
else {
alert(themessage);
return false;
}
}
</script>
</head>
<body bgcolor="#FFFFFF">
<font face="Tahoma" color="000000">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top">
<form action="mailto:what@ever.com?subject=IMS Pipeline Information Form" Form method="post" enctype="text/plain" name="form" onsubmit="return verify()">
<p><font size="14">IMS Pipeline Information Form</font> </p>
<table cellSpacing="3" cellPadding="0" width="100%" border="0">
<tr>
<td><fieldset>
<legend><strong>1: Project Information (General Information) </strong></legend>
Project Name <font color="red">*</font>
<input type="text" name="ProjectName" size="20"><br>
Type <font color="red">*</font> <select name="Type" size="1">
<option value="">Choose One...</option>
<option value="BCM">BCM</option>
<option value="Asset-Mgmt">Asset Mgmt.</option>
<option value="Capacity-Mgmt">Capacity Mgmt.</option>
<option value="Change-Mgmt">Change Mgmt.</option>
<option value="Config-mgnt">Config Mgmt.</option>
<option value="Decomission">Decommission</option>
<option value="Implementation">Implementation</option>
<option value="Decomission">Migration</option>
<option value="Migration-Decomission">Migration / Decommission</option>
<option value="Ongoing">Ongoing</option>
<option value="Project">Project</option>
<option value="SLE-Reporting">SLE & Reporting</option>
<option value="Sys-Monitoring">Sys. Monitoring</option>
<option value="Other">Other</option>
</select> </fieldset> </td>
</tr>
<tr>
<td><fieldset>
<legend><strong>2: Progess (What is the current stage you are at?) </strong></legend>
Start Date <font color="red">*</font>
<input type="text" name="StartDate" size="20"> End Date
<font color="red">*</font>
<input type="text" name="EndDate" size="20"> <br>
Status <font color="red">*</font>
<select name="Status" size="1">
<option value="">Choose One...</option>
<option value="Complete">Complete</option>
<option value="In-Progress">In-Progress</option>
<option value="On-Hold">On-Hold</option>
<option value="Post-Imp">Post Imp.</option>
<option value="Pending">Pending</option>
<option value="Planning">Planning</option>
<option value="TBA">To Be Announced...</option>
</select> </fieldset> </td>
</tr>
<br>
<TABLE cellSpacing="0" cellPadding="4" border="0" width="100%">
<TR>
<td colSpan="2">
<fieldset>
<legend><strong>3: Project Teams <font size="3">(Who's working on this project?)</font> </strong></legend>
<center>------ Select whom ever applies ------</center>
</font>
</TD>
<tr>
<td width="11%" valign="top" align="left">
<b>IMS Eight</b><br>
<INPUT name="Eight-Team" type=checkbox value="Phil Collins">Phil Collins</input><br>
<INPUT name="Eight-Team" type=checkbox value="John Doe">John Doe</input><br>
</td>
<td width="14%" valign="top" align="left">
<b>IMS AIMS</b><br>
<INPUT name="AIMS-Team" type=checkbox value="Phil Collins">Phil Collins</input><br>
<INPUT name="AIMS-Team" type=checkbox value="John Doe">John Doe</input><br>
</td>
<td width="12%" valign="top" align="left">
<b>IMS DES</b><br>
<INPUT name="DES-Team" type=checkbox value="Phil Collins">Phil Collins</input><br>
<INPUT name="DES-Team" type=checkbox value="John Doe">John Doe</input><br>
</td>
<td width="12%" valign="top" align="left">
<b>IMS DevCon</b><br>
<INPUT name="DevCon-Team" type=checkbox value="Phil Collins">Phil Collins</input><br>
<INPUT name="DevCon-Team" type=checkbox value="John Doe">John Doe</input><br>
</td>
<td width="14.5%" valign="top" align="left">
<b>IMS WIS</b><br>
<INPUT name="WIS-Team" type=checkbox value="Phil Collins">Phil Collins</input><br>
<INPUT name="WIS-Team" type=checkbox value="John Doe">John Doe</input><br>
</td>
<td width="13.5%" valign="top" align="left">
<b>L1/eHelp/ChatiT</b><br>
<INPUT name="L1-Team" type=checkbox value="Scot Lynch">Scot Lynch</input><br>
<INPUT name="L1-Team" type=checkbox value="John Doe">John Doe</input><br>
</td>
</tr>
</table>
<tr>
<td><fieldset>
<legend><strong>4: Submit Information </strong></legend>
<div align="center">
<input type="submit" value="Submit">
<input type="reset" value="Reset"></div>
<div align="center">
* May prompt to send a second time, ignore if your message was sent *
</div>
</fieldset>
<div align="center">
<font color="red">*</font> <i>Denotes Required Field.</i>
</div>
</td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</form>
</body>
</html>
carl_mcdade
08-03-2004, 07:28 AM
Untested. Just writing of the top of my head. A simple way.
$file_handle = fopen("new_file.txt",w+);
Foreach ($_POST as $k->$v){
fputs($file_handle,"$k: $v");
}
close($file_handle);
Will get the information into a file. Then ou just have to attach it to the mail.
carl_mcdade
08-03-2004, 07:41 AM
Oh yuck!, I just had a look at your code. The reason i say yuck is that you are using mailto: in your form. To send an attachment via this is going to be a pain. You will either have to loopback to the form and submit it via javascript or use two forms. It is easier and safer (no spam) to use PHP mail().
slikrick87
08-03-2004, 02:33 PM
I really need some help on this, could I get some code? I don't know almost any PHP and I'm new to the HTML thing, so please, i really need some help. I really need all the data sent in a .txt file instead of everything just being sent in the email windows.
carl_mcdade
08-03-2004, 06:04 PM
http://codewalkers.com/tutorials/72/1.html
slikrick87
08-03-2004, 07:42 PM
thanks alot, I really appreciate your help.
I could tell this tutorial is going to help me alot, thanks again.
slikrick87
08-03-2004, 08:56 PM
My Company's server doesn't support PHP, and I need a way to have the data entered from the form below sent to my email in a .txt file. Also someone said mailto: isn't good or secure or something, anyone have any idea, really in need of feedback.
Here's my code...
_________________________________________________________________
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>IMS Pipeline Information Form</title>
<SCRIPT LANGUAGE="JavaScript">
function verify() {
var themessage = "You are required to complete the following fields: ";
if (document.form.ProjectName.value=="") {
themessage = themessage + "Project Name";
}
if (document.form.Type.value=="") {
themessage = themessage + ", Type";
}
if (document.form.StartDate.value=="") {
themessage = themessage + ", Start Date";
}
if (document.form.EndDate.value=="") {
themessage = themessage + ", End Date";
}
if (document.form.Status.value=="") {
themessage = themessage + ", Status";
}
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
document.form.submit();
}
else {
alert(themessage);
return false;
}
}
</script>
</head>
<body bgcolor="#FFFFFF">
<font face="Tahoma" color="000000">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top">
<form action="mailto:what@ever.com?subject=IMS Pipeline Information Form" Form method="post" enctype="text/plain" name="form" onsubmit="return verify()">
<p><font size="14">IMS Pipeline Information Form</font> </p>
<table cellSpacing="3" cellPadding="0" width="100%" border="0">
<tr>
<td><fieldset>
<legend><strong>1: Project Information (General Information) </strong></legend>
Project Name <font color="red">*</font>
<input type="text" name="ProjectName" size="20"><br>
Type <font color="red">*</font> <select name="Type" size="1">
<option value="">Choose One...</option>
<option value="BCM">BCM</option>
<option value="Asset-Mgmt">Asset Mgmt.</option>
<option value="Capacity-Mgmt">Capacity Mgmt.</option>
<option value="Change-Mgmt">Change Mgmt.</option>
<option value="Config-mgnt">Config Mgmt.</option>
<option value="Decomission">Decommission</option>
<option value="Implementation">Implementation</option>
<option value="Decomission">Migration</option>
<option value="Migration-Decomission">Migration / Decommission</option>
<option value="Ongoing">Ongoing</option>
<option value="Project">Project</option>
<option value="SLE-Reporting">SLE & Reporting</option>
<option value="Sys-Monitoring">Sys. Monitoring</option>
<option value="Other">Other</option>
</select> </fieldset> </td>
</tr>
<tr>
<td><fieldset>
<legend><strong>2: Progess (What is the current stage you are at?) </strong></legend>
Start Date <font color="red">*</font>
<input type="text" name="StartDate" size="20"> End Date
<font color="red">*</font>
<input type="text" name="EndDate" size="20"> <br>
Status <font color="red">*</font>
<select name="Status" size="1">
<option value="">Choose One...</option>
<option value="Complete">Complete</option>
<option value="In-Progress">In-Progress</option>
<option value="On-Hold">On-Hold</option>
<option value="Post-Imp">Post Imp.</option>
<option value="Pending">Pending</option>
<option value="Planning">Planning</option>
<option value="TBA">To Be Announced...</option>
</select> </fieldset> </td>
</tr>
<br>
<TABLE cellSpacing="0" cellPadding="4" border="0" width="100%">
<TR>
<td colSpan="2">
<fieldset>
<legend><strong>3: Project Teams <font size="3">(Who's working on this project?)</font> </strong></legend>
<center>------ Select whom ever applies ------</center>
</font>
</TD>
<tr>
<td width="11%" valign="top" align="left">
<b>IMS Eight</b><br>
<INPUT name="Eight-Team" type=checkbox value="Phil Collins">Phil Collins</input><br>
<INPUT name="Eight-Team" type=checkbox value="Brittney Spears<">Brittney Spears<</input><br>
</td>
<td width="14%" valign="top" align="left">
<b>IMS AIMS</b><br>
<INPUT name="AIMS-Team" type=checkbox value="Phil Collins">Phil Collins</input><br>
<INPUT name="AIMS-Team" type=checkbox value="Brittney Spears<">Brittney Spears<</input><br>
</td>
<td width="12%" valign="top" align="left">
<b>IMS DES</b><br>
<INPUT name="DES-Team" type=checkbox value="Phil Collins">Phil Collins</input><br>
<INPUT name="DES-Team" type=checkbox value="Brittney Spears">Brittney Spears</input><br>
</td>
<td width="12%" valign="top" align="left">
<b>IMS DevCon</b><br>
<INPUT name="DevCon-Team" type=checkbox value="Bob">Bob</input><br>
<INPUT name="DevCon-Team" type=checkbox value="Jane">Jane</input><br>
</td>
<td width="14.5%" valign="top" align="left">
<b>IMS WIS</b><br>
<INPUT name="WIS-Team" type=checkbox value="George Dole">George Dole</input><br>
<INPUT name="WIS-Team" type=checkbox value="Suzzy Lin">Suzzy Lin</input><br>
</td>
<td width="13.5%" valign="top" align="left">
<b>L1/eHelp/ChatiT</b><br>
<INPUT name="L1-Team" type=checkbox value="John Doe">Doe Joe</input><br>
<INPUT name="L1-Team" type=checkbox value="Jane Lane">Jane Lane</input><br>
</td>
</tr>
</table>
<tr>
<td><fieldset>
<legend><strong>4: Submit Information </strong></legend>
<div align="center">
<input type="submit" value="Submit">
<input type="reset" value="Reset"></div>
<div align="center">
* May prompt to send a second time, ignore if your message was sent *
</div>
</fieldset>
<div align="center">
<font color="red">*</font> <i>Denotes Required Field.</i>
</div>
</td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</form>
</body>
</html>
Warning: slikrick87, I've edited all your code above to remove company names and email addresses. The company has made known to me this is confidential information, and they prefer them not displayed. If you wish to post additional code, please remove all personal names and emails from it first. Also, please reduce your code to just the barebones- posting a long code is the fastest way to turn people off from looking over it and helping out. See our posting guidelines here: http://www.codingforums.com/postguide.htm
Nightfire
12-16-2004, 12:55 AM
If you haven't got php, then you can't write to a txt file, so you can't send the contents of the form to your email with a txt file. Unless you own the server and running on windows, then I guess you could use jscript? But I guess if you did have your own server, you'd have installed php already on it so I'm babbling away for no reason :p
If you haven't got phpthen you shouldn't post your question in the PHP-forum
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.