i have a problem with sending a mail with php inside
03-26-2006, 06:58 AM
|
i have a problem with sending a mail with php inside
|
Posts: 5
|
hy i have a site where i have some products... so i have this site that works like this i have produse1.php that outputs the products from a mysql database. on this page i have a form which has a field where u insert the quantity. this form has the action on profrom.php which outputs a bill. and i want on this page to insert the users's data and send the bill and the contact data to my email. i will give u the website and the source code to understand what i mean. So the website is http://www.e-acoperis.ro/produse1.php from there just folow the forms so the first source code is produse1.php
PHP Code:
<?php session_start(); mysql_connect(); mysql_select_db("***") or die("nu mere"); $result=mysql_query( "select * from placio"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Eacoperis</title> </head> <body bgcolor="#ACB5C6"> <table> <tr align="center" valign="middle"> <td> <img src="spacer.gif" width=320" height="13" border="0" alt=""> </td> <td> <form action="proform.php" method="post" name="job" id="job" target="_blank"> </td> </tr> </table> <table border="1" align="center" bordercolor="green"> <tr> <td> Cod_Produs </td> <td> Poza </td> <td> Nume produs </td> <td> Descriere </td> <td> Pret </td> <td> Promotie </td> <td> Achizitie </td> <td> Numar Bucati </td> </tr> <?php mysql_connect(); mysql_select_db("***") or die("nu mere"); $result=mysql_query( "select * from placio"); while ($row = mysql_fetch_array($result)) { ?> <tr> <td> <? printf($row[0]); ?> </td> <td> <img src="<? printf($row[1]); ?>.jpg" border="0" alt="" width="50" height="50"> </td> <td> <? printf($row[2]); ?> </td> <td> <? printf($row[3]); ?> </td> <td> <? printf($row[4]); ?> </td> <td> <? printf($row[5]); ?> </td> <td> <input type="checkbox" name="a<?printf($row[0]);?>" id="b<?printf($row[0]);?>"> </td> <td> <input type="text" name="b<?printf($row[0]);?>" id="b<?printf($row[0]);?>"> </td> </tr> <? }?> </table> <table align="center"> <tr> <img src="spacer.gif" width="1" height="30" border="0" alt=""> </tr> <tr> <td><input type="submit" value="Trimite"></td> <td><input type="reset" value="Reseteaza"></td> </tr> </table>
</form> </body> </html>
this is profrom.php
PHP Code:
<? session_start(); ?> <html> <title>Factura proforma</title> <body> <table align="center"> <tr> <td> <td> DATA FACTURARII : <? $zile = array('duminica', 'luni', 'marti', 'miercuri', 'joi', 'vineri', 'sambata'); $ziua = date('w', time()); $luni = array('decembrie','ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie','august','septembrie','octombrie','noiembrie','decembrie'); $luna = date('n',time()); printf($ziua = $zile[$ziua]); printf(", "); printf(date("j")); printf(", "); printf($luna=$luni[$luna]); printf(", "); printf(date("Y")); $z=1; $xp=0; ?> </td> <tr> </table> <table border='1' class='dre' bordercolor='#dddddd' cellspacing='0' cellpadding='2' width=96% align=center> <tr bgcolor='#eeeeee'> <td>Nr.<br>crt. </td> <td>Denumirea produselor<br>sau a serviciilor</td> <td>U.M.</td> <td>Cantitatea</td> <td>Pretul unitar<br>(fara T.V.A.)</td> <td>Valoare</td><td>valoare TVA</td> </tr> <?mysql_connect(); mysql_select_db("****") or die("nu mere"); $result=mysql_query( "select * from placio") or die ("muie"); while ($row = mysql_fetch_array($result)) { error_reporting(0); $arr=$_POST["a$row[0]"]; $rew=$_POST["b$row[0]"]; IF($arr){ IF ($rew!== 0){ $_SESSION["f$xp"]=$rew; $xp++; ?> <tr> <td> <?printf($z); $z++;?> </td> <td> <?printf($row[2]);?> </td> <td> buc. </td> <td> <? printf($rew);?> </td> <td> <?printf($row[4]);?> </td> <td> <? printf($row[4]*$rew); ?> </td> <td> <? printf("%1.2f" , $row[4]*$rew*19/100); $sum=$row[4]* $rew; $val=$val+$sum ; $tva= $row[4]*$rew*19/100 + $tva; ?> </td> <? }}} ?> <tr> <td colspan="4" rowspan="2" align="center" valign="bottom" class="antet2"> Discount total:<br>0</td> <td class='antet' rowspan=2>TOTALURI</td> <td><?printf("%1.2f",$val);?></td> <td><?printf("%1.2f",$tva)?></td></tr> <tr> <td colspan=2><?printf("%1.2f",$val+$tva)?></td></tr> </table> <form action="mail.php" method="post"> <table>
<tr><td>Numele: </td><td><input type="text" name="nume" id="nume"></td></tr> <tr><td>Prenume: </td><td><input type="text" name="prenume" id="prenume"></td></tr> <tr><td>Firma: </td><td><input type="text" name="firma" id="firma"></td></tr> <tr><td>Adresa: </td><td><input type="text" name="adresa" id="adresa"></td></tr> <tr><td>Oras: </td><td><input type="text" name="oras" id="oras"></td></tr> <tr><td>Telefon: </td><td><input type="text" name="telefon" id="telefon"></td></tr> <tr><td>Email: </td><td><input type="text" name="email" id="email"></td></tr> <a href="mail.php"><input type="submit" name="Trimite" value="Trimite Comanda"></a> <input type="Reset"> </form> </table> </body> </html>
and this is mail.php i consider not taking this one very much into consideration
PHP Code:
<? session_start(); ?> <? $num = $_POST['nume']; $pren=$_POST['prenume']; $firma=$_POST['firma']; $adresa=$_POST['adresa']; $oras=$_POST['oras']; $telefon=$_POST['telefon']; $email=$_POST['email']; $xp=0; ?> <html> <title>Factura proforma</title> <body> <table align='center'> <tr> <td> <td> DATA FACTURARII : <? $zile = array('duminica', 'luni', 'marti', 'miercuri', 'joi', 'vineri', 'sambata'); $ziua = date('w', time()); $luni = array('decembrie','ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie','august','septembrie','octombrie','noiembrie','decembrie'); $luna = date('n',time()); printf($ziua = $zile[$ziua]); printf(', '); printf(date('j')); printf(', '); printf($luna=$luni[$luna]); printf(', '); printf(date('Y')); $z=1; $xp=0; ?> </td> <tr> </table> <table border='1' class='dre' bordercolor='#dddddd' cellspacing='0' cellpadding='2' width=96% align=center> <tr bgcolor='#eeeeee'> <td>Nr.<br>crt. </td> <td>Denumirea produselor<br>sau a serviciilor</td> <td>U.M.</td> <td>Cantitatea</td> <td>Pretul unitar<br>(fara T.V.A.)</td> <td>Valoare</td><td>valoare TVA</td> </tr> <?mysql_connect("localhost","***","***"); mysql_select_db('***') or die('nu mere'); $result=mysql_query( 'select * from placio') or die ('muie'); while ($row = mysql_fetch_array($result)) { error_reporting(0); $g=$_SESSION["f$xp"]; IF($g>0){ ?> <tr> <td> <?printf($z); $z++;?> </td> <td> <?printf($row[2]);?> </td> <td> buc. </td> <td> <? printf($g);?> </td> <td> <?printf($row[4]);?> </td> <td> <? printf($row[4]*$g); ?> </td> <td> <? printf('%1.2f' , $row[4]*$g*19/100); $sum=$row[4]* $g; $val=$val+$sum ; $tva= $row[4]*$g*19/100 + $tva; $xp++; ?> </td> <? }} ?> <tr> <td colspan='4' rowspan='2' align='center' valign='bottom' class='antet2'> Discount total:<br>0</td> <td class='antet' rowspan=2>TOTALURI</td> <td><?printf('%1.2f',$val);?></td> <td><?printf('%1.2f',$tva)?></td></tr> <tr> <td colspan=2><?printf('%1.2f',$val+$tva)?></td></tr> </table> </body> </html>
<?$mess=" <html> <body> Nume: printf($num); Preunume: printf($pren); Firma :printf($firma); Adresa : printf($adresa); Oras : printf($oras); Telefon : printf($telefon); Email : printf($email); Produsul : </body> </html>";?> <?mail("dragos_vintu@yahoo.com","Comanda", "<html> <title>Factura proforma</title> <body> <table align='center'> <tr> <td> <td> DATA FACTURARII : $zile = array('duminica', 'luni', 'marti', 'miercuri', 'joi', 'vineri', 'sambata'); $ziua = date('w', time()); $luni = array('decembrie','ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie','august','septembrie','octombrie','noiembrie','decembrie'); $luna = date('n',time()); printf($ziua = $zile[$ziua]); printf(', '); printf(date('j')); printf(', '); printf($luna=$luni[$luna]); printf(', '); printf(date('Y')); $z=1; $xp=0; </td> <tr> </table> <table border='1' class='dre' bordercolor='#dddddd' cellspacing='0' cellpadding='2' width=96% align=center> <tr bgcolor='#eeeeee'> <td>Nr.<br>crt. </td> <td>Denumirea produselor<br>sau a serviciilor</td> <td>U.M.</td> <td>Cantitatea</td> <td>Pretul unitar<br>(fara T.V.A.)</td> <td>Valoare</td><td>valoare TVA</td> </tr> while ($row = mysql_fetch_array($result)) { error_reporting(0); IF($g>0){ <tr> <td> printf($z); $z++; </td> <td> printf($row[2]); </td> <td> buc. </td> <td> printf($g); </td> <td> <?printf($row[4]); </td> <td> <? printf($row[4]*$g); </td> <td> printf('%1.2f' , $row[4]*$g*19/100); $sum=$row[4]* $g; $val=$val+$sum ; $tva= $row[4]*$g*19/100 + $tva; $xp++; </td> }} <tr> <td colspan='4' rowspan='2' align='center' valign='bottom' class='antet2'> Discount total:<br>0</td> <td class='antet' rowspan=2>TOTALURI</td> <td>printf('%1.2f',$val);</td> <td>printf('%1.2f',$tva)</td></tr> <tr> <td colspan=2>printf('%1.2f',$val+$tva)</td></tr> </table> </body> </html>");?>
so please help me!
Last edited by 0beron : 03-26-2006 at 08:15 AM.
|
|
|
|
03-26-2006, 08:18 AM
|
Re: i have a problem with sending a mail with php inside
|
Posts: 1,832
Location: Somewhere else entirely
|
Can you tell us what it is doing, or not doing - do you get an error message? does the email not send? If we know what it is doing at the moment we have a better idea of where to look to start fixing it.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Scribble Pad MOD for phpBB (aka MSN handwriting for forums)
|
|
|
|
03-26-2006, 08:43 AM
|
Re: i have a problem with sending a mail with php inside
|
Posts: 5
|
ok the problem is on mail.php.... when it sends the message the message is empty... proform.php and produse1.php are functional... there are there to see where the variables are coming from and see what i want.... so the problem is how can i mail the first table from proform.php..... the table and its contents... because the problem is that inside a variable the compiler does not work for example $message=" while () {sintax} does not compile... that is the ideea. any ideea?
|
|
|
|
03-26-2006, 10:11 AM
|
Re: i have a problem with sending a mail with php inside
|
Posts: 47
Name: Eric
Location: Florida
|
You can't just insert PHP code into a string and expect it to execute, you need to construct the string.
http://php.net/language.operators.string
__________________
PHP / mySQL Developer
|
|
|
|
03-26-2006, 11:21 AM
|
Re: i have a problem with sending a mail with php inside
|
Posts: 5
|
i tried that... it just wont construct.
|
|
|
|
03-26-2006, 11:23 AM
|
Re: i have a problem with sending a mail with php inside
|
Posts: 5
|
and even
|
|
|
|
03-26-2006, 11:24 AM
|
Re: i have a problem with sending a mail with php inside
|
Posts: 5
|
and even if i do that how would that help me?
|
|
|
|
03-26-2006, 09:07 PM
|
Re: i have a problem with sending a mail with php inside
|
Posts: 47
Name: Eric
Location: Florida
|
You tried it? It "just wont" construct? How about showing the code you "tried" ?
How would it help you? It would actually work the way you're supposed to do things. The way you're trying to do it, while possible, is extraordinarily unfeasible.
__________________
PHP / mySQL Developer
|
|
|
|
|
« Reply to i have a problem with sending a mail with php inside
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|