Jump to content

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 = 'myemail@myemail.com';
$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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.