getting ID on this auto-mailling script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
musson
Forum Newbie
Posts: 8
Joined: Thu Apr 16, 2009 4:03 pm

getting ID on this auto-mailling script

Post by musson »

Hi. Here I need help to set the variable $orderid.
Im not sure what to use to set it, I tried a couple of thing but it aint working.
There is the script, only one line missing, the $orderid set line
Thanks for your time!! :)



<?
require_once("conn.php");
require_once("header.php");
if(isset($_POST[s9]))
{
$today = date("F j, Y, g:i a");
$to = $aset[MerchantEmail];
$MyMessage = "This email was sent by $_SERVER[HTTP_HOST] Billing Departement:";
$MyMessage .= "\n To view the order Via the admin panel just use the fallowing link:\n";
$MyMessage .= "www.sumcloth.com/ViewOrder.php?OrderID=$orderid";
$MyMessage .= "\n Or access the order panel manualy via www.?????.com/siteadmin using the fallowing ID: $orderid \n"
$MyMessage .= "\n Some more information about the order. You will need to access the website to get more usefull informations.\n";
$MyMessage .= "\n Total Price:\n";
$MyMessage .= stripslashes($_POST[OrderTotal]);
$MyMessage .= "\n First Name:\n";
$MyMessage .= stripslashes($_POST[FirstName]);
$MyMessage .= "\n Last Name:\n";
$MyMessage .= stripslashes($_POST[LastName]);
$MyMessage .= "\n Shipping Address:\n";
$MyMessage .= stripslashes($_POST[ShippingAddress1]);
$MyMessage .= stripslashes($_POST[ShippingState]);
$MyMessage .= "\n Buyer E-mail\n";
$MyMessage .= stripslashes($_POST[YourEmail]);
$MyMessage .= "\n-------------------------------------------------------------------\n";
$MyMessage .= "Your order Is being reviewed, $today";
$MySubject = "$today $_POST[OrderTotal]" ;
$YourSubject = "$today, Your Final Order";
$to1 = "$_POST[YourEmail]";
$from = "From: BillingDepartement @???.com";
$YourMsg = "This is a test email, we receved your order";
$YourMsg .= "you suck hard";
$YourMsg .= "Billing departement.";
mail($to1, $YourSubject, $YourMsg, $from);
mail($to, $MySubject, $MyMessage, $from);

$message = "<center><b>Thank you for your Order</b></center>";

unset($_POST);
}



$q1 = "insert into devbg_orders set
ShippingPrice = '$_POST[ShippingPrice]',
SalesTax = '$NewSalesTax',
OrderTotal = '$NewTotal',
ShipToFirstName = '$_POST[FirstName]',
ShipToLastName = '$_POST[LastName]',
ShipToAddress1 = '$_POST[ShippingAddress1]',
ShipToAddress2 = '$_POST[ShippingAddress2]',
ShipToCity = '$_POST[ShippingCity]',
ShipToCountry = '$_POST[ShippingCountry]',
ShipToState = '$_POST[ShippingState]',
ShipToPhone = '$_POST[ShippingPhone]',
ShipToZIP = '$_POST[ShippingZip]',
BillToFirstName = '$_POST[ch1]',
BillToLastName = '$_POST[ch2]',
BillToAddress1 = '$_POST[BillingAddress1]',
BillToAddress2 = '$_POST[BillingAddress2]',
BillToCity = '$_POST[BillingCity]',
BillToState = '$_POST[BillingState]',
BillToCountry = '$_POST[BillingCountry]',
BillToZIP = '$_POST[BillingZip]',
BillToPhone = '$_POST[BillingPhone]',
ClientEmail = '$_POST[YourEmail]',
OrderDate = '$today' ";
mysql_query($q1) or die(mysql_error());

//get the OrderID
$q1 = "select last_insert_id()";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

mysql_query("update devbg_orders_content set OrderID = '$a1[0]' where OrderID = '$PHPSESSID' ") or die(mysql_error());
require_once("templates/PaymentTemplate.php");

require_once("footer.php");

?>
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: getting ID on this auto-mailling script

Post by Eric! »

WTF? What are you trying to do?

If you just need to set it to a value then

$orderid='123456789';

And stick it in there after your line that says $to=....
Post Reply