Welcome to WebmasterWorld Guest from 126.96.36.199
$writestring = "\"" . $name . "\",\"" . $phone . "\",\"" . $email . "\",\"" . $date . "\",\"" . $comments . "\"\r\n";
$filepointer = fopen("file-home.csv","a");
Now I have two questions:
1. Is this safe if hackers try to attack?
2. I need to know where the form originated. I have five businesses using five forms on five html pages. Each busienss has it's own server directory, and each directory has a form and index.html page set up just for that business. But, all the info from all the forms must go into the ONE .txt file. Is there an easy bit of code I could put in the form so it would automatically send a new field (business#1 for instance) so I would know where it was coming from. Ideally it would only go to the .txt file, and not in the email message. But I would live with it if "business#1" went to both email and .txt.
What I'm trying to end up with is a text file with:
name, phone, email, date, comments - all entered by the user
business#1 - last entry in the .txt file would be automatically entered and would show me from which web page or business the info orginated.
Thanks a bunch. I wouldn't have gotten this far without your help.
2) You could put a hidden field in your form to specify the business it's coming from.
<input type=hidden name=business value=business1>
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
The from element, obviously, grabs it on load (if available) and writes it into the hidden value and sends it off to the processor.