Results 1 to 2 of 2

Thread: PHP form with XML

  1. #1

    PHP form with XML

    I'm not very familiar with XML but my boss is asking me to send the forms we use (through PHPl) to an xml file so it can go directly to our lead manager. Does anyone know how I can do this? I've been googling and researching for over 2 hours now and I'm not finding much help. Right now I have the site written in PHP, the forms sent through PHPMail to his email. He gave me an email address for the lead manager but it only accepts xml files. Any help would be greatly appreciated!

  2. #2
    I'm admittedly not a PHP expert, but I think this would work:
    PHP Code:
    <?php 
    // you would change these to your form values and add any
    // special ones that you may have
    $mailto "youremail@whatever.com";
    $from "me@mydomain.com";

    $subject "mail to xml test";
    $mssg "hello this is my message";

    // set headers
    $headers "From: "$from ."\n";
    $headers .= "MIME-Version: 1.0 \n";
    $headers .= "Content-Type: text/html; charset='us-ascii' \n";
    $headers .= "Reply-To: $from \r\n";
    $headers .= "Return-path: $from";

    // make the message into xml
    $xml_mssg "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?> \n".
                
    "<mail> \n".
                
    "<from>$from</from> \n".
                
    "<subject>$subject</subject> \n".
                
    "<message>$mssg</message> \n".
                
    "</mail> \n";
    // fire off the mail
    $mail_sent = @mail($mailto$subject$xml_mssg$headers);
    // check if the message is sent ok
    echo $mail_sent "Mail sent" "Mail failed";
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012