los rios logo

Information Technology 

 Information Technology: Creating Web Pages at Los Rios

divider
gray fill gray fill transparent


How do I collect my web form data into a spreadsheet?

This advanced form service will allow you to email the web form information and collect the information into a datafile for importing to a spreadsheet. The datafile must live in your web account on the web server. When you want to review the data, you must FTP that file to your workstation, then "import" it into Excel. Follow the documentation for setting up a basic form, then add the information below for this advanced form.

The following lines in your program must be changed:

<form method="POST" action="/cgi-bin/LRCMail.cgi">

  (Use your valid email address)
<input type="hidden" name="recipient" value= "username@campus.losrios.edu">  
 
New Hidden Fields you must define in order to write the output to your flat file. You will also want to review the LRCMail Documentation  to better understand how the functions listed below work.

( Append field values to a flat-file datafile that has been created, this file will be a basic text file)
<input type="hidden" name="
append_db" value="/home/username/public_html/datafiles/customer.csv">  

( Specify exactly which fields are appended to the datafile. Any field not specified in db_fields will not be appended to the datafile. Be sure to check for correct spelling, and remember, capitalization matters)
<input type="hidden" name="
db_fields" value="realname,email,homephone,comments"

( Define the separator character to use between the fields in the datafile. Avoid using common characters, like @, that might be used in the data.)
<input type="hidden" name="
db_delimiter" value="|"


(Update your  text fields below to match your data fields)
<br><nobr>Name:</nobr><input SIZE="50" name="
realname"> <br>
Telephone:</nobr><input SIZE="20" name="
homephone"> <br><p>

Comments: <br>
<textarea
name="comments" ROWS="3" COLS="60"></textarea> </p>

(If you want to return email back to the user, you must use the variable name ="email" for this field. Lowercase is critical in naming this field.)
E-Mail:</nobr><input TYPE="text"  name="email"> </p>


The form below is to be used only as an example. You will need to 'View Page Source' to see how to setup the fields. 

Additional information needed in order for this form to work:

  • TESTING IS IMPORTANT 

  • DO NOT USE this form for private or sensitive information. This is NOT SECURE.

  • Recipient Email Address MUST be a valid Los Rios Email Address (Specifically losrios.edu)

  • Your web form MUST reside on an authorized Los Rios web server

  • You must link to your html page that contains the form with a full URL link such as www.crc.losrios.edu. 

  • Create a directory just for your datafiles. The directory must allow "world write" permissions. You may want to call this directory "datafiles" so you only have to have one for all your spreadsheet form needs.

  • Your datafile must already exist and must also allow "world write" to it.

  • If the datafile does not exist, but the rest of the form is set up correctly, the email is still sent  to the recipient, but no ERROR messages are listed alerting the owner that there is not a datafile available to write too. 

Example Script

<!-- ACTUAL FORM CODE STARTS HERE-->
<!--DO NOT CHANGE THE FOLLOWING LINE OR YOUR SCRIPT WILL NOT WORK-->
<label for="form1" accesskey="1"></label>
<form method="POST" action="/cgi-bin/LRCMail.cgi" id="form1" tabIndex="1">
<input type="hidden" name="recipient" value="itstaff@losrios.edu">
<input type="hidden" name="subject" value="Test - Advanced LRCMail">
<input type="hidden" name="print_blank_fields" value="1">
<input type="hidden" name="bgcolor" value="#FFFFFF">
<input type="hidden" name="return_link_url" value="/services/technology/lrc_adv_form.htm">
<input type="hidden" name="return_link_title" value="Advanced Form Mail Test Page">
<input type="hidden" name="append_db" value="/home/itstaff/public_html/form/datafile.txt">
<input type="hidden" name="db_fields" value="realname,email,homephone,comments">
<input type="hidden" name="db_delimiter" value="|">
<div align="left">
  <p><nobr><label for="fullname">Name: </label></nobr>
   <input SIZE="50" name="realname" id="fullname"><br>
   <nobr><label for="phone">Telephone: </label></nobr>
   <input SIZE="20" name="homephone" id="phone"><br>
   <nobr><label for="email">E-Mail: </label></nobr>
   <input size="50" name="email" id="email">
  </p>
</div>
<div align="left">
   <p>Comments:<br>
   <label for="comments" accesskey="1"></label>
   <textarea NAME="comments" ROWS="5" COLS="50" id="comments" tabIndex="2"></textarea></p>
</div>
<div align="left">
   <p>Please click on the SEND button below.</p>
</div>
<p>
  <input TYPE="SUBMIT" value="SEND">
  <input TYPE="RESET" value="CLEAR">
</p>
</form>
<!--END OF THE FORM-->

back to top

 

transparent