Hejsa, til alle jer der ude.
Jeg har et lille problem, vedrørende et script, som skal gøre det muligt at bestille pizza, online.
For at sige det kort, og godt, så viser jeg bare de sider, som jeg har lavet.
Dette er index.php - Som mere eller mindre bare et en form, med tabeller, tekst, og felter, hvor der skal angives, hvor mange pizzaer man vil have.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Adobe GoLive" />
<title>bestilling</title>
<link href="css/basic.css" rel="stylesheet" type="text/css" media="all" />
<style type="text/css" media="screen"><!--
#antal { color: #00f; font-size: 10px; line-height: 14px; text-align: center; width: 16px; height: 16px; border: solid 1px #999; }
#knap { color: #f1ebf3; background-color: #004080; width: 50px; height: 20px; margin-right: 1px; border-width: 0; }
--></style>
</head>
<body>
<h1>Bestil din mad</h1>
<h3>Pizza</h3>
<form id="order" action="modtage.php" method="post" name="order">
<div id="wrapper">
<table border="0" cellspacing="0" cellpadding="0">
<tr height="20">
<td align="center" valign="middle" bgcolor="#6b8e23" width="30" height="20">
<p align="right"><font color="white"><strong>Nr</strong></font></p>
</td>
<td align="center" valign="middle" bgcolor="#6b8e23" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#6b8e23" width="50" height="20">
<p><font color="#f1ebf3"><strong>Antal</strong></font></p>
</td>
<td valign="middle" bgcolor="#6b8e23" width="500" height="20">
<p><font color="#f1ebf3"><strong>Navn og beskrivelse</strong></font></p>
</td>
<td valign="middle" bgcolor="#6b8e23" width="60" height="20">
<p><font color="#f1ebf3"><strong>alm.</strong></font></p>
</td>
<td valign="middle" bgcolor="#6b8e23" width="60" height="20">
<p><font color="#f1ebf3"><strong>deep.</strong></font></p>
</td>
<td valign="middle" bgcolor="#6b8e23" width="60" height="20">
<p><font color="#f1ebf3"><strong>fam.</strong></font></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" width="30" height="20">
<div align="right">
<p><strong>1</strong></p>
</div>
</td>
<td align="center" valign="middle" width="10" height="20"></td>
<td align="center" valign="middle" width="50" height="20"><input id="antal" type="text" name="antal" size="1" /></td>
<td valign="middle" width="500" height="20">
<p><span class="navn">Margherita</span> tomat, ost</p>
</td>
<td valign="middle" width="60" height="20">
<p><input type="radio" name="pris" value="37" checked="checked" />36,-</p>
</td>
<td valign="middle" width="60" height="20">
<p><input type="radio" name="pris" value="66" />53,-</p>
</td>
<td valign="middle" width="60" height="20">
<p><input type="radio" name="pris" value="53" />66,-</p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" bgcolor="#e7e4fa" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>2</strong></p>
</div>
</td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="50" height="20"><input id="antal" type="text" name="antal2" size="1" /></td>
<td valign="middle" bgcolor="#e7e4fa" width="500" height="20">
<p><span class="navn">Vesuvio</span> tomat, ost, skinke</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p><input type="radio" name="pris2" value="40" checked="checked" />40,-</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p><input type="radio" name="pris2" value="63" />63,-</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p><input type="radio" name="pris2" value="76" />76,-</p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>3</strong></p>
</div>
</td>
<td align="center" valign="middle" width="10" height="20"></td>
<td align="center" valign="middle" width="50" height="20">
<input id="antal" type="text" name="antal3" size="1" /></td>
<td valign="middle" width="500" height="20">
<p><span class="navn">Palermo</span> tomat, ost, champignon, fetaost, oliven, artiskok</p>
</td>
<td valign="middle" width="60" height="20">
<p><input type="radio" name="pris3" value="40" checked="checked" />47,-</p>
</td>
<td valign="middle" width="60" height="20">
<p><input type="radio" name="pris3" value="69" />69,-</p>
</td>
<td valign="middle" width="60" height="20">
<p><input type="radio" name="pris3" value="99" />99,-</p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" bgcolor="#e7e4fa" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>4</strong></p>
</div>
</td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="50" height="20">
<input id="antal" type="text" name="antal4" size="1" /></td>
<td valign="middle" bgcolor="#e7e4fa" width="500" height="20">
<p><span class="navn">Bari </span>tomat, ost, skinke</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p><input type="radio" name="pris4" value="40" checked="checked" />46,-</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p><input type="radio" name="pris4" value="68" />68,-</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p><input type="radio" name="pris4" value="84" />84,-</p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>5</strong></p>
</div>
</td>
<td align="center" valign="middle" width="10" height="20"></td>
<td align="center" valign="middle" width="50" height="20">
<p><input id="antal" type="text" name="antal5" size="1" /></p>
</td>
<td valign="middle" width="500" height="20">
<p><span class="navn">Hawaii</span> tomat, ost</p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" bgcolor="#e7e4fa" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>6</strong></p>
</div>
</td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="50" height="20">
<p><input id="antal" type="text" name="antal6" size="1" /></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="500" height="20">
<p><span class="navn">Capricciosa</span> tomat, ost</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>7</strong></p>
</div>
</td>
<td align="center" valign="middle" width="10" height="20"></td>
<td align="center" valign="middle" width="50" height="20">
<p><input id="antal" type="text" name="antal7" size="1" /></p>
</td>
<td valign="middle" width="500" height="20">
<p><span class="navn">Juventus</span> tomat, ost</p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" bgcolor="#e7e4fa" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>8</strong></p>
</div>
</td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="50" height="20">
<p><input id="antal" type="text" name="antal8" size="1" /></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="500" height="20">
<p><span class="navn">O'sole Mio</span> tomat, ost</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" width="30" height="20">
<div align="right">
<p><strong>9</strong></p>
</div>
</td>
<td align="center" valign="middle" width="10" height="20"></td>
<td align="center" valign="middle" width="50" height="20">
<p><input id="antal" type="text" name="antal9" size="1" /></p>
</td>
<td valign="middle" width="500" height="20">
<p><span class="navn">Timah</span> tomat, ost</p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" bgcolor="#e7e4fa" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>10</strong></p>
</div>
</td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="50" height="20">
<p><input id="antal" type="text" name="antal10" size="1" /></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="500" height="20">
<p><span class="navn">Aimar</span> tomat, ost</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" width="30" height="20">
<div align="right">
<p><strong>11</strong></p>
</div>
</td>
<td align="center" valign="middle" width="10" height="20"></td>
<td align="center" valign="middle" width="50" height="20">
<p><input id="antal" type="text" name="antal11" size="1" /></p>
</td>
<td valign="middle" width="500" height="20">
<p><span class="navn">Amore</span> tomat, ost</p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" bgcolor="#e7e4fa" width="30" height="20">
<div align="right">
<p><strong>12</strong></p>
</div>
</td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="50" height="20">
<p><input id="antal" type="text" name="antal12" size="1" /></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="500" height="20">
<p><span class="navn">Roma</span> tomat, ost</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" width="30" height="20">
<div align="right">
<p><strong>13</strong></p>
</div>
</td>
<td align="center" valign="middle" width="10" height="20"></td>
<td align="center" valign="middle" width="50" height="20">
<p><input id="antal" type="text" name="antal13" size="1" /></p>
</td>
<td valign="middle" width="500" height="20">
<p><span class="navn">Ppperoni</span> tomat, ost</p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" bgcolor="#e7e4fa" width="30" height="20">
<div align="right">
<p><strong>14</strong></p>
</div>
</td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="50" height="20">
<p><input id="antal" type="text" name="antal14" size="1" /></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="500" height="20">
<p><span class="navn">Lucas</span> tomat, ost</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" width="30" height="20">
<div align="right">
<p><strong><font color="red">*</font>15</strong></p>
</div>
</td>
<td align="center" valign="middle" width="10" height="20"></td>
<td align="center" valign="middle" width="50" height="20">
<p><input id="antal" type="text" name="antal15" size="1" /></p>
</td>
<td valign="middle" width="500" height="20">
<p><span class="navn">Dicle</span> tomat, ost</p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
<td valign="middle" width="60" height="20">
<p></p>
</td>
</tr>
<tr height="20">
<td align="center" valign="middle" bgcolor="#e7e4fa" width="30" height="20">
<div align="right">
<p><strong>999</strong></p>
</div>
</td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="10" height="20"></td>
<td align="center" valign="middle" bgcolor="#e7e4fa" width="50" height="20">
<p><input id="antal" type="text" name="antal16" size="1" /></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="500" height="20">
<p><span class="navn">Mascapone</span> tomat, ost</p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
<td valign="middle" bgcolor="#e7e4fa" width="60" height="20">
<p></p>
</td>
</tr>
</table>
</div>
<p><input id="knap" type="submit" name="" value="Sum" /><input id="knap" type="reset" value="Nulstil" /></p>
</form>
</body>
</html>
Dette er modtage.php - Hvor der via vises, hvad kunden har bestilt, og hvor meget prisen for alle pizzaerne bliver, ialt. Derefter skulle det meget gerne sendes til emailen, som jeg skriver i koden.
<?php
if(isset($_POST['navn'])){
$modtager="email@email.dk";
$korsel =100;
$emne="$_POST[emne]";
$meddelelse="<h4>$_POST[navn] har bestilt: $korsel item(s)</h4>
" . "Online bestiling fra:<b> $_POST[navn]</b><br>
Adresse:<b> $_POST[adresse]</b><br>
Post:<b> $_POST[postnummer]</b><br>
By:<b> $_POST[by]</b><br>
Udbringning:<b> $_POST[ud]</b><br>
Selvhentning:<b> $_POST[sh]</b><br>
Tlf.:<b> $_POST[telefon]</b>";
$headers='MIME-Version: 1.0' . "\\r\\n" .
'Content-type: text/html; charset=iso-8859-1' . "\\r\\n" . 'from:email@email.dk' . "\\r\\n" . 'Reply-To:email@email.dk';
mail($modtager, $emne, $meddelelse, $headers);
echo "<p>Tak for din bestilling. <br />Vi sende din bestilling snarest muligt...<br/></p>
<p></p>
<p><a href='index.php'>Tilbage til bestillingsside...</a></p>";
};
?>
<?php
if(!isset($_POST['navn'])){?>
<form id="bestil_pizza" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="bestil_pizza" target="_self">
<h4>Du har valgt:</h4>
<h4><!--1--><?php
$antal = $_POST['antal'];
$pris = $_POST['pris'];
$regning = ($antal * $pris);
$total = $regning;
if(($_POST['antal']))
{echo "$antal Margherita pizza, som koster $regning,- kr.";}
else {" ";}?></h4>
<p><!--2--><?php
$antal2 = $_POST['antal2'];
$pris2 = $_POST['pris2'];
$regning2 = ($antal2 * $pris2);
$total2 = $regning2;
if(($_POST['antal2']))
{echo "$antal2 Margherita pizza, som koster $regning2,- kr.";}
else {" ";}?></p>
<p><!--3--><?php
$antal3 = $_POST['antal3'];
$pris3 = $_POST['pris3'];
$regning3 = ($antal3 * $pris3);
$total3 = $regning3;
if(($_POST['antal3']))
{echo "$antal3 Margherita pizza, som koster $regning3,- kr.";}
else {" ";}?></p>
<p><!--4--><?php
$antal4 = $_POST['antal4'];
$pris4 = $_POST['pris4'];
$regning4 = ($antal4 * $pris4);
$total4 = $regning4;
if(($_POST['antal4']))
{echo "$antal4 Margherita pizza, som koster $regning4,- kr.";}
else {" ";}?></p>
<p><!--kørsel og opsuming--><?php
$korsel = 25;
$sum = $total + $total2 + $total3 +$total4 + $korsel;
echo "Kørsel $korsel,- kr.";
echo "<br>";
echo "I alt $sum, kr.";
echo "<br>";
echo "<br>";
echo "<br>";
echo "<br>";
?></p>
<p><input type="hidden" name="emne" value="Bestilling"></p>
<p>Navn:<input type="text" name="navn" size="24"></p>
<p>Adresse:<input type="text" name="adresse" size="24"></p>
<p>Postkod:<input type="text" name="postnummer" size="24"></p>
<p>By:<input type="text" name="by" size="24"></p>
<p>Tlf.:<input type="text" name="telefon" size="24"></p>
<p><textarea name="besked" rows="4" cols="40"></textarea></p>
<p></p>
<p></p>
<p><input type="radio" name="ud" value="skal bringes ud"> Udbringning</p>
<p><input type="radio" name="sh" value="hentes af migselv"> Selvhentning</p>
<p><input type="submit" name="submit" value="Send"><input type="reset" value="Nulstil"></p>
</form>
<p><?php } ?></p>
Og dette er så bare en normal HTML side, som efter bestillingen vil takke kunden, for at havde bestilt.
<h3>Tak for bestillingen
</h3>
<p>Vi prøver vores bedst at sende din bestilling snarest muligt..!</p>
<p><a href="index.php" target="_self">Tilbage til bestllingside</a></p>
-------------------
Men problemet er bare det, at når man har bestilt og angiet navn, adresse, telefon nr osv. så sende der en mail til den email adresse jeg har angivet. Men i mailen står der f.eks følgende:
Eltaftevez har bestilt:
100 item(s)Online bestiling fra:
EltaftevezAdresse:
københavnergadestyrerPost:
9999By:
københavnUdbringning:
skal bringes udSelvhentning:
Tlf.:
88888888Det er så det eneste der står i emailen. Men, kan nogen af jer der ude få den til at sende en mail som denne:
Eltaftevez har bestilt:
1 Margherita pizza, som koster 40,- kr.
2 Margherita pizza, som koster 80,- kr.
Kørsel 25,- kr.
I alt 145, kr.
Online bestiling fra: Eltaftevez
Adresse: københavnergadestyrer
Post: 9999
By: københavn
Udbringning: skal bringes ud
Selvhentning:
Tlf.: 88888888
Dvs. så den viser i mailen, som bliver åbnet på pizzariaet, hvad der er bestilt, hvor mange der er blevet bestilt af dem, samt hvad prisen bliver ialt.
- Jeg ville blive hamrende glad, og lykkelig, hvis en af jer kunne hjælpe mig med mit problem. Er der tilfældet, at I ikke forstår problemet, så vil jeg med glæde uddybe det, så det bliver forståeligt for en hver.