Jump to content

Dump form data to a text or XML file?


tmallen

Recommended Posts

I have a form I've been using for a couple years to send email to me as feedback from my website. Now I'd like to use it to save a subscriber's information for a mailing list. Ideally, it will be moved into an XML file that I can easily output with XSLT. Anyway, here's the script. What would I need to modify to make this change? Not that the print line at the end is just there as a placeholder for a true redirect page.

 

<?php # Mailing List Script for {recipient} by {my name} 2007

$to = '[email protected]';
$subject = 'Mailing List Signup';
$mailheaders = 'From: websiteURL';

// Grab the form and assign to variables

$name		= $_REQUEST['name'];
$company	= $_REQUEST['company'];
$title		= $_REQUEST['title'];

$address	= $_REQUEST['address'];
$address2	= $_REQUEST['address2'];
$city		= $_REQUEST['city'];
$state		= $_REQUEST['state'];

$phone		= $_REQUEST['phone'];
$email		= $_REQUEST['email'];


// Send the mail

$body =	"Name: "	.$name."\n".
	"Company: "	.$company."\n".
	"Title: "	.$title."\n".
	"Address: "	.$address."\n".
	"Address 2: "	.$address2."\n".
	"City: "	.$city."\n".
	"State: "	.$state."\n".
	"Phone: "	.$phone."\n".
	"Email: "	.$email."\n";


mail ($to, $subject, $body, $mailheaders);

print "sent successfully!";

?>

Link to comment
https://forums.phpfreaks.com/topic/74924-dump-form-data-to-a-text-or-xml-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.