Avatar billede fixbabe Nybegynder
05. november 2005 - 18:45 Der er 4 kommentarer og
1 løsning

email som txt eller html

Jeg er løbet ind i et problem, mange af mine kunder kan ikke læse/modtage mails i html format. Jeg ønsker en drop down box hvor kunden kan vælge om de vil modtage kopi af faktura som html eller som plain txt.

Script:
<?php
include("inc_func_basket.php");
if(!checkBasketContent()) {
    include("inc_head.php");
    print "Kurven er tom";
    include("inc_bottom.php");
    exit;
}

switch($_GET['step']) {
    default: options(); break;
    case persinfo: personalInfo($_POST['shipment'], $_POST['payment']); break;
    case confirm: confirm($_POST['shipment'], $_POST['payment']); break;
    case order: order(); break;
}

function options() {
    include("inc_head.php");
   
    if($_GET['msg'] == "fail") print "<center><font color='red'>Du skal både vælge forsendelse- og betalingsmetode</font></center>";
   
    print "<form action='".$PHP_SELF."?step=persinfo' method='post'>
    <table cellspacing='2' cellpadding='2' align='center'>
    <tr bgcolor='white'>
        <td height='20' bgcolor='#ebebeb' colspan='2' width='400'> &nbsp; <font size='2'><b>» Forsendelse</b></td>
    </tr>";
   
    $ship_query = mysql_query("Select * from $Tmethod_shipment order by name");
    while($ship_row = mysql_fetch_array($ship_query)) {
        $ship_price_float = $ship_row['price'];
   
        if($ship_row['weightdependent'] == 1) {
            $sum_weight_float = getProWeight();
            $shipweight_query = mysql_query("Select * from $Tmethod_shipment_weight where sid='".$ship_row['id']."' and weightlimit>='".$sum_weight_float."' order by weightlimit limit 1") or die(mysql_error());
            $shipweight_row = mysql_fetch_array($shipweight_query);
           
            $ship_price_float += $shipweight_row['price'];
        }
       
        $ship_price_float = valuta($ship_price_float);
       
        print "<tr bgcolor='white'>
            <td width='40' bgcolor='#f3f3f3' valign='middle' align='center'><input type='radio' name='shipment' value='".$ship_row['id']."'></td>
            <td width='360'><b>".$ship_row['name']." (+".$ship_price_float." kr)</b><br>".$ship_row['shorttext']."</td>
        </tr>";
    }

    print "<tr bgcolor='white'>
        <td height='20' bgcolor='#ebebeb' colspan='2' width='400'> &nbsp; <font size='2'><b>» Betaling</b></td>
    </tr>";
   
    $pay_query = mysql_query("Select * from $Tmethod_payment order by name");
    while($pay_row = mysql_fetch_array($pay_query)) {
        $pay_price_float = valuta($pay_row['price']);
   
        print "<tr bgcolor='white'>
            <td width='40' bgcolor='#f3f3f3' valign='middle' align='center'><input type='radio' name='payment' value='".$pay_row['id']."'></td>
            <td width='360'><b>".$pay_row['name']." (+".$pay_price_float." kr)</b><br>".$pay_row['shorttext']."</td>
        </tr>";
    }
   
    print "<tr bgcolor='white'>
        <td colspan='2' align='right' style='padding-top: 2px; padding-bottom: 2px;'><input type='submit' value='Videre'></td>
    </tr>
    </table>
    </form>";
   
    include("inc_bottom.php");
}

function personalInfo($shipment, $payment) {
    if($shipment == 0 || $payment == 0) header("Location: $PHP_SELF?step=options&msg=fail");
    include("inc_head.php");
   
    print "<table cellspacing='2' cellpadding='2' align='center'>
    <tr bgcolor='white'>
        <td height='20' bgcolor='#ebebeb' colspan='2' width='300'> &nbsp; <font size='2'><b>» Tidligere kunde</b></td>
    </tr>
    <form action='".$PHP_SELF."?step=confirm' method='post'>
    <input type='hidden' name='shipment' value='".$shipment."'>
    <input type='hidden' name='payment' value='".$payment."'>
    <tr bgcolor='white'>
        <td width='100' bgcolor='#f3f3f3'>Telefonnr.:</td>
        <td width='200'><input type='text' name='phoneget' maxlength='8' style='width: 200px;'></td>
    </tr>
    <tr bgcolor='white'>
        <td colspan='2' align='right' style='padding-top: 2px; padding-bottom: 2px;'><input type='submit' value='Hent info'></td>
    </tr>
    </form>
    <tr bgcolor='white'>
        <td height='20' bgcolor='#ebebeb' colspan='2' width='300'> &nbsp; <font size='2'><b>» Ny kunde</b></td>
    </tr>
    <form action='".$PHP_SELF."?step=confirm' method='post'>
    <input type='hidden' name='shipment' value='".$shipment."'>
    <input type='hidden' name='payment' value='".$payment."'>
    <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Evt firma:</td>
            <td width='200'><input type='text' name='firm' value='".$_POST['firm']."' style='width: 200px;'></td>
    </tr>
    <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Fulde navn:</td>
            <td width='200'><input type='text' name='name' value='".$_POST['name']."' style='width: 200px;'></td>
    </tr>
    <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Adresse:</td>
            <td width='200'><input type='text' name='adress' value='".$_POST['adress']."' style='width: 200px;'></td>
    </tr>
    <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Postnr. og by:</td>
            <td width='200'><input type='text' name='zipcode' value='".$_POST['zipcode']."' maxlength='4' style='width: 40px;'> <input type='text' name='city' value='".$_POST['city']."' style='width: 156px;'></td>
    </tr>
    <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Telefonnr.:</td>
            <td width='200'><input type='text' name='phone' value='".$_POST['phone']."' maxlength='8' style='width: 200px;'></td>
    </tr>
    <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>E-mail.:</td>
            <td width='200'><input type='text' name='email' value='".$_POST['email']."' style='width: 200px;'></td>
    </tr>
    <tr bgcolor='white'>
        <td colspan='2' align='right' style='padding-top: 2px; padding-bottom: 2px;'><input type='submit' value='Videre'></td>
    </tr>
    </form>
Her <u>skal</u> du skrive din adresse, navn, telefon nr osv ellers kan vi ikke kontakte dig og dit køb vil være ugyldigt.
<br><br><i>Dine info vil ikke blive videre givet eller på anden måde udleveret.</i><br><br>
    </table>
    </form>";
   
    include("inc_bottom.php");
}

class Confirm {
    var $firm;
    var $name;
    var $adress;
    var $zipcode;
    var $city;
    var $phone;
    var $email;
   
    var $shipment;
    var $payment;
   
    var $heading;
   
    function getData($firm, $name, $adress, $zipcode, $city, $phone, $email, $shipment, $payment, $heading) {
        $this->firm = $firm;
        $this->name = $name;
        $this->adress = $adress;
        $this->zipcode = $zipcode;
        $this->city = $city;
        $this->phone = $phone;
        $this->email = $email;
       
        $this->shipment = $shipment;
        $this->payment = $payment;
       
        $this->heading = $heading;
    }
   
    function printBasket() {
        include("admin/inc_connection.php");
       
        print "<table cellspacing='2' cellpadding='2' align='center'>
        <tr bgcolor='white'>
            <td height='20' bgcolor='#ebebeb' colspan='3' width='400'> &nbsp; <font size='2'><b>» Indkøbskurv</b></td>
        </tr>";
       
        $sum_price_float = 0;
        for($basket=0; $basket<count($_SESSION['basketProduct']); $basket++) {
            $pro_id_int = $_SESSION['basketProduct'][$basket];
            $pro_number_int = $_SESSION['basketNumber'][$basket];
           
            if($pro_number_int > 0) {
                $pro_query = mysql_query("Select name from $Tproducts where id='".$pro_id_int."'");
                $pro_row = mysql_fetch_array($pro_query);
           
                $pro_price_float = getProPrice($pro_id_int);
           
                $pro_price_float = $pro_price_float*$pro_number_int;
                $sum_price_float += $pro_price_float;
                $pro_price_float = round($pro_price_float, 2);
                $pro_price_float = valuta($pro_price_float);
           
                print "<tr bgcolor='white'>
                    <td width='40' bgcolor='#f3f3f3' valign='middle' align='center'>".$pro_number_int."</td>
                    <td width='290'><b>".$pro_row['name']."</b></td>
                    <td width='70' align='right'><font color='#4781B1'>".$pro_price_float." kr</font></td>
                </tr>";
            }
        }
       
        // Get expense for shipment
       
        $ship_query = mysql_query("Select * from $Tmethod_shipment where id='".$_POST['shipment']."'");
        $ship_row = mysql_fetch_array($ship_query);
       
        $ship_price_float = $ship_row['price'];
   
        if($ship_row['weightdependent'] == 1) {
            $sum_weight_float = getProWeight();
            $shipweight_query = mysql_query("Select * from $Tmethod_shipment_weight where sid='".$ship_row['id']."' and weightlimit>='".$sum_weight_float."' order by weightlimit limit 1") or die(mysql_error());
            $shipweight_row = mysql_fetch_array($shipweight_query);
           
            $ship_price_float += $shipweight_row['price'];
        }
       
        $sum_price_float += $ship_price_float;
       
        // Get expense for payment
       
        $pay_query = mysql_query("Select * from $Tmethod_payment where id='".$_POST['payment']."'");
        $pay_row = mysql_fetch_array($pay_query);
       
        $pay_price_float = $pay_row['price'];
       
        $sum_price_float += $pay_price_float;
       
        print "<tr bgcolor='white'>
            <td colspan='2' align='right'>Forsendelse:</td>
            <td align='right'><font color='#4781B1'>".valuta($ship_price_float)." kr</font></td>
        </tr>
        <tr bgcolor='white'>
            <td colspan='2' align='right'>Betaling:</td>
            <td align='right'><font color='#4781B1'>".valuta($pay_price_float)." kr</font></td>
        </tr>
        <tr bgcolor='white'>
            <td colspan='2' align='right'><b>Sammenlagt:</b></td>
            <td align='right'><font color='#4781B1'>".valuta($sum_price_float)." kr</font></td>
        </tr>
        </table>";
    }
   
    function printForm() {
        $form_std_input = "<input type='hidden' name='firm' value='".$this->firm."'>
        <input type='hidden' name='name' value='".$this->name."'>
        <input type='hidden' name='adress' value='".$this->adress."'>
        <input type='hidden' name='zipcode' value='".$this->zipcode."'>
        <input type='hidden' name='city' value='".$this->city."'>
        <input type='hidden' name='phone' value='".$this->phone."'>
        <input type='hidden' name='email' value='".$this->email."'>
        <input type='hidden' name='shipment' value='".$this->shipment."'>
        <input type='hidden' name='payment' value='".$this->payment."'>";
   
        print "<table cellspacing='2' cellpadding='2' align='center'>
        <tr bgcolor='white'>
            <td height='20' bgcolor='#ebebeb' colspan='3' width='432'> &nbsp; <font size='2'><b>» ".$this->heading."</b></td>
        </tr>
        <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Firma:</td>
            <td width='300'>".$this->firm."</td>
        </tr>
        <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Fulde navn:</td>
            <td width='300'>".$this->name."</td>
        </tr>
        <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Adresse:</td>
            <td width='300'>".$this->adress."</td>
        </tr>
        <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Postnr. og by:</td>
            <td width='300'>".$this->zipcode." ".$this->city."</td>
        </tr>
        <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Telefonnr.:</td>
            <td width='300'>".$this->phone."</td>
        </tr>
        <tr bgcolor='white'>
            <td width='100' bgcolor='#f3f3f3'>Email:</td>
            <td width='300'>".$this->email."</td>
        </tr>
        <tr bgcolor='white'>
            <form action='".$PHP_SELF."?step=order' method='post'>
            <td width='100' bgcolor='#f3f3f3'>Kommentar:</td>
            <td width='300'><textarea name='comment' rows='5' style='width: 310px;' cols='20'></textarea></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' bgcolor='#f3f3f3' style='padding-top: 2px; padding-bottom: 2px;' colspan='2'>
                ".$form_std_input."
                <b>Ved tryk på Send bestilling accepterer vores
<a target='_blank' href='site_information.php?id=4' style='text-decoration: none'>betingelser</a>
og regler</b><br><input type='submit' value='Send bestilling'>
            </td>
            </form>
        </tr>
        <tr bgcolor='white'>
            <form action='".$PHP_SELF."?step=persinfo' method='post'>
            <td style='padding-top: 2px; padding-bottom: 2px;' colspan='2' align='left'>
                ".$form_std_input."
                <input type='submit' value='Tilbage'>
            </td>
        </tr>
        </table>";
    }
}

function confirm($shipment, $payment) {
    include("inc_head.php");
    if($_POST['phoneget']) {
        $cus_query = mysql_query("Select * from $Tcustomers where phone='".$_POST['phoneget']."'");
        if(mysql_num_rows($cus_query) == 1) {
            $cus_row = mysql_fetch_array($cus_query);
            $confirmInfo = new Confirm;
            $confirmInfo->getData($cus_row['firm'], $cus_row['name'], $cus_row['adress'], $cus_row['zipcode'], $cus_row['city'], $cus_row['phone'], $cus_row['email'], $shipment, $payment, "Tidligere kunde");
            $confirmInfo->printBasket();
            print "<br><br>";
            $confirmInfo->printForm();
        } else {
            print "<form action='".$PHP_SELF."?step=persinfo' method='post'>
            <input type='hidden' name='shipment' value='".$shipment."'>
            <input type='hidden' name='payment' value='".$payment."'>
            <center>
                <font color='red'>Du blev ikke fundet i kundekartoteket</font><br>
                <input type='submit' value='Tilbage'>
            </center>
            </form>";
        }
    } elseif($_POST['name'] && $_POST['adress'] && $_POST['zipcode'] && $_POST['city'] && $_POST['phone'] && $_POST['email']) {
        $confirmInfo = new Confirm;
        $confirmInfo->getData($_POST['firm'], $_POST['name'], $_POST['adress'], $_POST['zipcode'], $_POST['city'], $_POST['phone'], $_POST['email'], $shipment, $payment, "Ny kunde");
        $confirmInfo->printBasket();
        print "<br><br>";
        $confirmInfo->printForm();
    } else {
        print "<form action='".$PHP_SELF."?step=persinfo' method='post'>
        <input type='hidden' name='shipment' value='".$shipment."'>
        <input type='hidden' name='payment' value='".$payment."'>
        <center>
            <font color='red'>Du skal udfylde alle felter</font><br>
            <input type='submit' value='Tilbage'>
        </center>
        </form>";
    }
    include("inc_bottom.php");
}

class Order {
    var $invoice_id;
    var $date;

    var $payexpense;
    var $freightexpense;

    var $settings_paymethod;
    var $settings_paymethod_mailtext;
    var $settings_shipment;
    var $settings_shipment_mailtext;

    var $seller_firm;
    var $seller_att;
    var $seller_adress;
    var $seller_zipcode;
    var $seller_city;
    var $seller_cvr;

    var $cus_id;
    var $cus_firm;
    var $cus_name;
    var $cus_adress;
    var $cus_zipcode;
    var $cus_city;
    var $cus_phone;
    var $cus_email;
    var $cus_comment;

    var $price;
    var $vat;
    var $sum;
    var $weight;
    var $level;

    var $products;

    function Order() {
        include("admin/inc_connection.php");

        $sell_query = mysql_query("Select * from $Tsettings");
        $sell_row = mysql_Fetch_array($sell_query);

        $this->seller_firm = $sell_row['firm'];
        $this->seller_att = $sell_row['att'];
        $this->seller_adress = $sell_row['adress'];
        $this->seller_zipcode = $sell_row['zipcode'];
        $this->seller_cvr = $sell_row['cvr'];
    }

    function getData() {
        include("admin/inc_connection.php");

        // Get price, weight and vat

        $sum_price_float = 0;
        $sum_weight_float = 0;
        $sum_vat_float = 0;

        for($basket=0; $basket<count($_SESSION['basketProduct']); $basket++) {
            $pro_id_int = $_SESSION['basketProduct'][$basket];
            $pro_number_int = $_SESSION['basketNumber'][$basket];
           
            $pro_query = mysql_query("Select * from $Tproducts where id='".$pro_id_int."'");
            if(mysql_num_rows($pro_query) == 1) {
                $pro_row = mysql_fetch_array($pro_query);
               
                $pro_row['offerfrom'] = str_replace("-", "", $pro_row['offerfrom']);
                $pro_row['offerto'] = str_replace("-", "", $pro_row['offerto']);
                $curdate = date("Ymd");
   
                if($pro_row['offerfrom'] <= $curdate && $pro_row['offerto'] >= $curdate && $pro_row['offerprice'] > 0) {
                    $pro_tmp_price = $pro_row['offerprice'];
                } else {
                    $pro_tmp_price = $pro_row['price'];
                }
               
                // Get Price
                $sum_price_float += $pro_tmp_price*$pro_number_int;
               
                // Get Weight
                $sum_weight_float += $pro_row['weight'];
               
                // Get Vat
                $pro_tmp_vatprocent_sum_float = $pro_row['vatprocent']+100;
                $pro_tmp_sum_without_vat = $pro_tmp_price/$pro_tmp_vatprocent_sum_float*100;
                $pro_tmp_sum_vat_float = ($pro_tmp_price-$pro_tmp_sum_without_vat)*$pro_number_int;
               
                $sum_vat_float += $pro_tmp_sum_vat_float;
               
                // Get product info for print
                $pro_unitprice_float = valuta($pro_tmp_price);
                $pro_sum_float = $pro_tmp_price*$pro_number_int;
                $pro_sum_float = round($pro_sum_float, 2);
                $pro_sum_float = valuta($pro_sum_float);
   
                $this->products .= "<tr>
                    <td>".$pro_id_int."</td>
                    <td>".$pro_row['name']."</td>
                    <td align='right'>".$pro_number_int."</td>
                    <td align='right'>".$pro_unitprice_float." kr</td>
                    <td align='right'>".$pro_sum_float." kr</td>
                </tr>
                <tr bgcolor='gray'>
                    <td colspan='5' height='1'></td>
                </tr>";
            }
        }
       
        // Get expense for shipment
       
        $ship_query = mysql_query("Select * from $Tmethod_shipment where id='".$_POST['shipment']."'");
        $ship_row = mysql_fetch_array($ship_query);
       
        $ship_price_float = $ship_row['price'];
        $this->settings_shipment_mailtext = $ship_row['mailtext'];
   
        if($ship_row['weightdependent'] == 1) {
            $sum_weight_float = getProWeight();
            $shipweight_query = mysql_query("Select * from $Tmethod_shipment_weight where sid='".$ship_row['id']."' and weightlimit>='".$sum_weight_float."' order by weightlimit limit 1") or die(mysql_error());
            $shipweight_row = mysql_fetch_array($shipweight_query);
           
            $ship_price_float += $shipweight_row['price'];
        }
       
        $sum_price_float += $ship_price_float;
       
        // Get expense for payment
       
        $pay_query = mysql_query("Select * from $Tmethod_payment where id='".$_POST['payment']."'");
        $pay_row = mysql_fetch_array($pay_query);
       
        $pay_price_float = $pay_row['price'];
        $this->settings_paymethod_mailtext = $pay_row['mailtext'];
       
        $sum_price_float += $pay_price_float;

        // Set local variables

        $this->date = date("Y-m-d");;

        $this->settings_paymethod = $_POST['payment'];
        $this->settings_shipment = $_POST['shipment'];
       
        $this->payexpense = valuta($pay_price_float);
        $this->freightexpense = valuta($ship_price_float);

        $this->price = $sum_price_float-$sum_vat_float;
        $this->vat = $sum_vat_float;
        $this->sum = $sum_price_float;
        $this->weight = getProWeight();

        $this->cus_firm = $_POST['firm'];
        $this->cus_name = $_POST['name'];
        $this->cus_adress = $_POST['adress'];
        $this->cus_zipcode = $_POST['zipcode'];
        $this->cus_city = $_POST['city'];
        $this->cus_phone = $_POST['phone'];
        $this->cus_email = $_POST['email'];
        $this->cus_comment = $_POST['comment'];
        $this->cus_ip = $_SERVER['REMOTE_ADDR'];
       
    }
   
    function getCusData() {
        return $this->cus_email;
    }
   
    function saveData() {
        include("admin/inc_connection.php");
       
        // Save customer
        $cus_query = mysql_query("Select id from $Tcustomers where
        firm='".$this->cus_firm."' and
        name='".$this->cus_name."' and
        adress='".$this->cus_adress."' and
        zipcode='".$this->cus_zipcode."' and
        city='".$this->cus_city."' and
        phone='".$this->cus_phone."' and
        email='".$this->cus_email."'");
        if(mysql_num_rows($cus_query) == 1) {
            $cus_row = mysql_fetch_array($cus_query);
            $this->cus_id = $cus_row['id'];
        } else {
            mysql_query("Insert into $Tcustomers set
            firm='".$this->cus_firm."',
            name='".$this->cus_name."',
            adress='".$this->cus_adress."',
            zipcode='".$this->cus_zipcode."',
            city='".$this->cus_city."',
            phone='".$this->cus_phone."',
            email='".$this->cus_email."',
            date='".$this->date."'");
           
            $this->cus_id = mysql_insert_id();
        }
               
        // Save order
        $lvl_query = mysql_query("Select id from $Torders_levels where consequence='2'");
        $lvl_row = mysql_fetch_array($lvl_query);
        $this->level = $lvl_row['id'];
       
        mysql_query("Insert into $Torders set
        cid='".$this->cus_id."',
        date='".$this->date."',
        sum='".$this->sum."',
        vat='".$this->vat."',
        payexpense='".$this->payexpense."',
        freightexpense='".$this->freightexpense."',
        paymethod='".$this->settings_paymethod."',
        shipment='".$this->settings_shipment."',
        weight='".$this->weight."',
        level='".$this->level."',
        ip='".$this->cus_ip."',
        comment='".$this->cus_comment."'");
       
        $this->invoice_id = mysql_insert_id();
       
        // Save products
        for($basket=0; $basket<count($_SESSION['basketProduct']); $basket++) {
            $pro_id_int = $_SESSION['basketProduct'][$basket];
            $pro_number_int = $_SESSION['basketNumber'][$basket];
           
            $pro_query = mysql_query("Select name from $Tproducts where id='".$pro_id_int."'");
            if(mysql_num_rows($pro_query) == 1) {
                $pro_row = mysql_fetch_array($pro_query);
               
                $pro_unitprice_float = getProPrice($pro_id_int);
                $pro_sum_float = $pro_unitprice_float*$pro_number_int;
                $pro_sum_float = round($pro_sum_float, 2);
           
                mysql_query("Insert into $Torders_products set
                oid='".$this->invoice_id."',
                pnumber='".$pro_id_int."',
                name=\"".$pro_row['name']."\",
                units='".$pro_number_int."',
                unitprice='".$pro_unitprice_float."',
                sum='".$pro_sum_float."'");
            }
        }
    }

    function invoice() {
        $invoice = "<br><br>
        <table cellspacing='1' cellpadding='2' bgcolor='gray' align='center' style='font: 10px Verdana;'>
        <tr bgcolor='#D1D1D1'>
            <td background='admin/images/td_header.jpg' width='450'>
                <font size=1><b>Ordrebekræftelse</b></font>
            </td>
        </tr>
        <tr bgcolor='white'>
            <td>
                <table cellspacing='0' cellpadding='2' width='100%' style='font: 10px Verdana;'>
                <tr>
                    <td width='60%' valign='top'>
                        Fakturanr: ".$this->invoice_id."<br>
                        Dato: ".$this->date."<br><br>

                        <b>Sælger:</b><br>
                        ".$this->seller_firm."<br>
                        /v ".$this->seller_att."<br>
                        ".$this->seller_adress."<br>
                        ".$this->seller_zipcode." ".$this->seller_city."<br>
                        CVR: ".$this->seller_cvr."
                    </td>
                    <td width='40%' valign='top'>
                        <b>Køber:</b><br>
                        ".$this->cus_name."<br>
                        ".$this->cus_adress."<br>
                        ".$this->cus_zipcode." ".$this->cus_city."<br>
                        Tlf. ".$this->cus_phone."<br><br>

                        Kundenr: ".$this->cus_id."
                    </td>
                </tr>
                </table>

                <br><br>

                <table width='100%' style='font: 10px Verdana;'>
                <tr>
                    <td><b>Varenummer</b></font></td>
                    <td><b>Tekst</b></font></td>
                    <td align='right'><b>Antal</b></td>
                    <td align='right'><b>Enhedspris</b></td>
                    <td align='right'><b>Samlet pris</b></td>
                </tr>

                <tr bgcolor='gray'>
                    <td colspan='5' height='1'></td>
                </tr>
                ".$this->products."
                <tr>
                    <td></td>
                    <td colspan='2'>Betalingsomkostninger:</td>
                    <td></td>
                    <td align='right'>".$this->payexpense." kr</td>
                </tr>
                <tr bgcolor='gray'>
                    <td colspan='5' height='1'></td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan='2'>Leveringsomkostninger:</td>
                    <td></td>
                    <td align='right'>".$this->freightexpense." kr</td>
                </tr>
                <tr bgcolor='gray'>
                    <td colspan='5' height='1'></td>
                </tr>

                <tr>
                    <td colspan='5' height='30'></td>
                </tr>
                <tr bgcolor='black'>
                    <td colspan='5' height='1'></td>
                </tr>
                <tr>
                    <td colspan='2'></td>
                    <td align='right' colspan='2'>Samlet uden moms:</td>
                    <td align='right'>".valuta($this->price)." kr</td>
                </tr>
                <tr>
                    <td colspan='2'></td>
                    <td align='right' colspan='2'>Moms:</td>
                    <td align='right'>".valuta($this->vat)." kr</td>
                </tr>
                <tr>
                    <td colspan='2'></td>
                    <td align='right' colspan='2'><b>Samlet med moms:</b></td>
                    <td align='right'><b><u>".valuta($this->sum)." kr</u></b></td>
                </tr>
                </table>
            </td>
        </tr>
        <tr bgcolor='#D1D1D1'>
            <td background='admin/images/td_header.jpg'>
                <font size=1><b>Betaling og forsendelse</b></font>
            </td>
        </tr>
        <tr bgcolor='white'>
            <td>
                <table cellspacing='0' cellpadding='2' width='100%' style='font: 10px Verdana;'>
                <tr>
                    <td valign='top' width='50%'><b>Betaling</b><br>".nl2br($this->settings_paymethod_mailtext)."</td>
                    <td valign='top' width='50%'><b>Forsendelse</b><br>".nl2br($this->settings_shipment_mailtext)."</td>
                </tr>
                </table>
            </td>
        </tr>
        </table>";
       
        return $invoice;
    }
}

function order() {
    include("inc_head.php");
   
    $sett_query = mysql_query("Select firm from $Tsettings");
    $sett_row = mysql_fetch_array($sett_query);
   
    $order = new Order;
    $order->getData();
    $order->saveData();
    print $order->invoice();
   
    $invoice_text = $order->invoice();
    $cus_email = $order->getCusData();
   
    /* To send HTML mail, you can set the Content-type header. */
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    /* additional headers */
    $headers .= "From: ".$sett_row['firm']." <salg@gamedelux.net>\r\n";
    $headers .= "Reply-to: salg@gamedelux.net\r\n";
    mail($cus_email, $sett_row['firm']." - Ordrebekræftelse", $invoice_text, $headers);
   
    unset($_SESSION['basketProduct'], $_SESSION['basketNumber']);
   
    include("inc_bottom.php");
}
?>

Link: http://gamedelux.net/products_order.php
Avatar billede bromer Nybegynder
05. november 2005 - 18:51 #1
Det giver mere mening at smide både en text og html version ud. Så kan din kundes mailklient selv vælge text versionen, hvis den ikke kan klare HTML.
Avatar billede fixbabe Nybegynder
05. november 2005 - 18:52 #2
lyder fornuftigt nok, men hvordan?
Avatar billede bromer Nybegynder
05. november 2005 - 19:44 #3
Jeg har valgt altid at benytte Mail_Mime [1], som er den del af Pear [2]. Det er faktisk super let og hvad du skal bruge har de faktisk lavet et eksempel på [3].

[1] http://pear.php.net/Mail_Mime
[2] http://pear.php.net
[3] http://pear.php.net/manual/en/package.mail.mail-mime.example.php
Avatar billede fixbabe Nybegynder
30. april 2006 - 00:06 #4
Lukker, fandt fejlen i en include fil.
Avatar billede fixbabe Nybegynder
30. april 2006 - 00:06 #5
trykker lige på svar kanppen denne gang
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester