Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add records to a data file from form on a web page

Status
Not open for further replies.

survivor

Programmer
Mar 8, 2001
8
US
I created an html form whic resides on one of my web sites. The form is completed by the user and then emailed to me, when he/she clicks the submit button. In the email, the titles of each field on the form preceed the contents the user entered, for example:

name: John Smith
company: ABC Widgets
street: 123 Someplace Road
city: Somewhere
state: XX
zipcode: 0U812

I want to input the data automatically into a data file without the need to key it.

Does anyone have a suggestion as to an efficient way to do this using vfp 6 or 7?

Thanks,
 
Hi survivor

Some time ago I had a similar project that was solved to the credit of other forum users.

My scenario was the same as yours where I received an email and had to extract a lot of the information from it, then extract only the data we needed and then add it to the appropriate field in the table.

Ok... lets call the table MYTABLE with fields EMAIL and ORDERTEXT

You will also need a memo field (example: EMAILBODY)

First thing is to "select all" and copy and paste the body of the email into your memo field EMAILBODY, then use the code below (Play around with the code to suit you etc)

Code:
* FIND AND EXTRACT THE CUSTOMER EMAIL ADDRESS

USE MYTABLE
APPEND BLANK

STORE "" TO lcbodyeml
STORE EMAILBODY TO lcbodyeml

STORE "" TO mfemail
STORE "Buyer e-mail: " TO mfemail
LOCATE FOR ATLINE(mfemail, lcbodyeml) != 0

STORE "" TO memailad
STORE MLINE(lcbodyeml, ATLINE(mfemail, lcbodyeml)) TO memailad
GO mrecno

REPLACE EMAIL WITH STRTRAN(memailad,"Buyer e-mail: ","")

* FIND AND EXTRACT THE CUSTOMER NAME AND ADDRESS

STORE "" TO lcnameadd
STORE EMAILBODY TO lcnameadd

lnLine = ATLINE('Delivery address',lcnameadd)
FOR i = 1 TO 8
    lcLine = MLINE(lcnameadd,lnLine+i)    
    IF i = 1 then
        lcResult = lcLine
    ELSE
        lcResult = lcResult + CHR(13) + lcLine
    ENDIF    
ENDFOR

REPLACE ORDERTEXT WITH ""
REPLACE ORDERTEXT WITH lcResult

Hope it helps

Lee...

Visual FoxPro Versions: 6 & 9
Operating System: Windows XP
 
Lee, thanks for the reply. I'ver been doing this with a slight variation: I copy the email contents into a text file then append the text file to a "dummy" file, and finally process the "dummy" file as you described.

I was wondering if there is a way to capture/store the data into a dbf file at the web site, then have my application automatically append the data from the web site dbf to a dbf on his computer?

The reason for this is the person for whom I am writing the application is not too computer literate and I am trying to automate everything as much as possible.

 
Hi Survivor

My undestanding of FrontPage is that you can capture / store data received from an online form in many different ways such as CSV file, HTML bulleted lists etc (I'm assuming you know this)

As far as extracting it direct from a table/file on a web server I have never tried this so sorry I cant be of any further help If the first post helped and someone else posts a reply, who knows!

Good luck

Lee...

Visual FoxPro Versions: 6 & 9
Operating System: Windows XP
 
Take a look at Golden Retriever: we designed it to do just what you want: It can download (POP3) just emails with a certain subject, or all emails, and stick them into a TXT file, which can then be imported into your program. You can even OLE-Automate it from within VFP to tell it to download, so the user doesn't have to be involved at all.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
The Golden Retriever web site shows it works with Windows 95/98/NT. Does it work with XP?

 
It should work on WinXp.
I hadn't tested it at the time the page was written. I develop mainly on Win2k and then test on the other environments.

If you would like to give it a try, send me an email (bill at aasportsware dot com) and I'll give you a download link so you can see how it works.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top