Jump to content

change to xml


abanksob1

Recommended Posts

hi

i have an online form in php to send in html and i need to change it, to send as a xml file please help.

 

<?

 

include_once "connect.php";

 

include_once "../functions.php";

 

 

 

if (!$compid) {

 

header("Location: login.php");

 

exit("Not logged in");

 

}

 

 

 

$ids = array();

 

$rs = mysql_query("SELECT id FROM leads WHERE origQuotes>$minOrigQuotes AND origQuotes>fetchedQuotes") or die(mysql_error());

 

while (list($id) = mysql_fetch_array($rs)) {

 

if (!empty($_REQUEST["cb$id"])) {

 

$ids[] = $id;

 

}

 

}

 

if (count($ids)) {

 

$ids = "(id=".implode(" OR id=", $ids).")";

 

$rs = mysql_query("SELECT leftLeads FROM companies WHERE id=$compid") or die(mysql_error());

 

list($limit) = mysql_fetch_array($rs);

 

}

 

else

 

$limit=$ids=0;

 

 

 

include "header.php";

 

 

 

$rs = mysql_query("SELECT email FROM companies WHERE id=$compid") or die(mysql_error());

 

list($compEmail) = mysql_fetch_array($rs);

 

 

 

$rs = mysql_query("SELECT * FROM leads WHERE $ids LIMIT $limit");

 

$ok=0;

 

 

 

while ($row = mysql_fetch_row($rs)) {

 

for ($x = 0; $x < mysql_num_fields($rs); $x++) {

 

$a=mysql_fetch_field($rs, $x);

 

${$a->name} = trim(stripslashes($row[$x]));

 

}

 

 

 

$MSG = "Name = $firstName $lastName<br>";

 

$MSG .= "Home Phone = $homePhone<br>";

 

$MSG .= "Work Phone = $workPhone<br>";

 

$MSG .= "Email = $email<br>";

 

$MSG .= "Move Date = ".date("m/d/Y", $Move_Date)."<br>";

$MSG .= "Move Size = $Move_Size<br>";

$MSG .= "From City = $From_City<br>";

 

$MSG .= "From State = $From_State<br>";

$MSG .= "From Zip = $From_Zip<br>";

$MSG .= "To City = $To_City<br>";

 

$MSG .= "To State = $To_State<br>";

 

$MSG .= "To Zip = $To_Zip<br>";

 

$MSG .= "Contact Preference = $contactPref<br>";

 

$MSG .= "Contact Time = $contactTime<br>";

 

$MSG .= "Comments = ".nl2br($comment)."<br>";

 

 

 

$MSG = "<div>$MSG</div>";

 

$headers = "MIME-Version: 1.0\n";

 

$headers .= "Content-type: text/html; charset=iso-8859-1\n";

 

$headers .= "From: Movers Community <info@moverscommunity.com>\n";

 

$subject = "Lead From Movers Community";

 

 

 

$st = mail($compEmail, $subject, $MSG, $headers);

 

echo ($st) ? "Lead #$id sent.<br>" : "Lead #$id couldn't be sent.<br>";

 

flush();

 

if ($st) {

 

$ok++;

 

mysql_query("UPDATE companies SET leftLeads=leftLeads-1, totalLeadsUsed=totalLeadsUsed+1 WHERE id=$compid") or die(mysql_error());

 

}

 

//echo "$MSG<BR><BR><BR>";

 

//die($MSG);

 

//header('location: thanks.php');

 

//exit();

 

}

 

 

 

echo "<br><br><center><big><b>";

 

echo "<span style='color:red'>$ok</span> leads were sent to $compEmail<br>";

 

echo "</b></big></center>";

 

 

 

include "footer.php";

 

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...