Ventu Posted December 11, 2007 Share Posted December 11, 2007 Hello guys I have a question for you. I work for an agent under dobson, and AT&T acquired us. My boss has 5 stores that we have ot send them ain store our cash sheets for the day by fax. I have come up with an idea to send a form www.totalcom.us/new/cashsheet.php by email. But since the coding id wrong more than likely the email output is really unorganized. This is the code : <? $from = "Totalcom"; $location = addslashes($_POST['location']); $month = addslashes($_POST['month']); $day = addslashes($_POST['day']); $year = addslashes($_POST['year']); $onect = addslashes($_POST['onect']); $fivect = addslashes($_POST['fivect']); $tenct = addslashes($_POST['tenct']); $twofivect = addslashes($_POST['twofivect']); $totald = addslashes($_POST['totald']); $onedt = addslashes($_POST['onedt']); $fivedt = addslashes($_POST['fivedt']); $tendt = addslashes($_POST['tendt']); $twoodt = addslashes($_POST['twoodt']); $fiftydt = addslashes($_POST['fiftydt']); $fivect = addslashes($_POST['fivect']); $fivect = addslashes($_POST['fivect']); $fivect = addslashes($_POST['fivect']); $totald = addslashes($_POST['totald']); $oneds = addslashes($_POST['oneds']); $fiveds = addslashes($_POST['fiveds']); $tends = addslashes($_POST['tends']); $twoods = addslashes($_POST['twoods']); $fiftyds = addslashes($_POST['fiftyds']); $hundredds = addslashes($_POST['hundredds']); $totals = addslashes($_POST['totals']); $onedb = addslashes($_POST['onedb']); $fivedb = addslashes($_POST['fivedb']); $tendb = addslashes($_POST['tendb']); $twoodb = addslashes($_POST['twoodb']); $fiftydb = addslashes($_POST['fiftydb']); $hundreddb = addslashes($_POST['hundreddb']); $totalb = addslashes($_POST['totalb']); $sendto = "mvolz@ventronicpcsys.com"; $subject = "$location $month $day $year"; $body = " Location = ". $location ."\n \n Month = ". $month ." Day = ". $day ." Year = ". $year ." \n \n $.01 = ". $onect ." $.05 = ". $fivect ." $.10 = ". $tenct ." $.25 = ". $twofivect ." \n $1.00 = ". $onedt ." $1.00 = ". $oneds ." $1.00 = ". $onedb ." $5.00 = ". $fivedt ." $5.00 = ". $fiveds ." $5.00 = ". $fivedb ." $10.00 = ". $tendt ." $10.00 = ". $tends ." $10.00 = ". $tendb ." $20.00 = ". $twoodt ." $20.00 = ". $twoods ." $20.00 = ". $twooedb ." $50.00 = ". $fiftydt ." $50.00 = ". $fiftyds ." $50.00 = ". $fiftydb ." $100.00 = ". $hundreddt ." $100.00 = ". $hundredds ." $100.00 = ". $hundreddb ." $Total: = ". $totald ." Total: = ". $totals ." Total: = ". $totalb ." \n \n "; mail($sendto, $subject, $body, $email); header( 'Location: cashsheet.php' ); ?> . Now all i want to do is make this email come out to a nice organized table for my boss. So i searched around and i found this: // multiple recipients $to = 'mvolz@ventronicpcsys.com' . ', '; // note the comma // subject $subject = '$location $month $day $year'; // message $body = " Location = ". $location ."\n \n Month = ". $month ." Day = ". $day ." Year = ". $year ." \n \n " $message = ' <html> <head> <title>$location Cash Sheet $month $day $year</title> </head> <body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mellisa Mathewson ' . "\r\n"; $headers .= 'From: Totalcom <blah@example>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); Just a basic layout for an HTML email. But i would like it dynamic, by changing the location of the stroe since there is 5. The date and the cash amounts. Also but not right now I would like the amounts to total in the Total boxes at the bottom. I'm running out of time so I hope this will be enough. Thanx guys Quote Link to comment Share on other sites More sharing options...
Cep Posted December 11, 2007 Share Posted December 11, 2007 I have to ask this question but this data is not security sensitive is it? If so I would seriously suggest NOT using email as a transfer medium. Just replace the values in your HTML with variables, run a query or conditional statement on the store/location (though I cannot see where you get this), populate the variables with the necessary data for that store and this will help you to make it dynamic. Quote Link to comment Share on other sites More sharing options...
Ventu Posted December 12, 2007 Author Share Posted December 12, 2007 have to ask this question but this data is not security sensitive is it? If so I would seriously suggest NOT using email as a transfer medium Well Its going to be everyone's dollar amounts of the day. I had the thought that it could be a risk, since its dollar amounts. But people wouldn't know what the dolalr amounts are for and what good would it give anyone. Unless this could be done by a database somehow. They just want to get away from the fax machine and be more high tech. I'm more of a hardware and A+ kinda guy but i would like to learn this stuff, I don't know any of the commands of PHP. All in all, its just going to be a set of dollar amounts that each store is bringing daily, if thats to much of a risk in yor eyes than i'll look to doing something different. THanx Quote Link to comment Share on other sites More sharing options...
Ventu Posted December 14, 2007 Author Share Posted December 14, 2007 hello again, alright I have decided to use this method anyways, but i have htaccessed the folder. But one thing i have a problem with, how do you implement php variables ( i think thats what they are called) into the HTML section of this PHP code: <? $location = addslashes($_POST['location']); $month = addslashes($_POST['month']); $day = addslashes($_POST['day']); $year = addslashes($_POST['year']); $onect = addslashes($_POST['onect']); $fivect = addslashes($_POST['fivect']); $tenct = addslashes($_POST['tenct']); $twofivect = addslashes($_POST['twofivect']); $totald = addslashes($_POST['totald']); $onedt = addslashes($_POST['onedt']); $fivedt = addslashes($_POST['fivedt']); $tendt = addslashes($_POST['tendt']); $twoodt = addslashes($_POST['twoodt']); $fiftydt = addslashes($_POST['fiftydt']); $fivect = addslashes($_POST['fivect']); $fivect = addslashes($_POST['fivect']); $fivect = addslashes($_POST['fivect']); $totald = addslashes($_POST['totald']); $oneds = addslashes($_POST['oneds']); $fiveds = addslashes($_POST['fiveds']); $tends = addslashes($_POST['tends']); $twoods = addslashes($_POST['twoods']); $fiftyds = addslashes($_POST['fiftyds']); $hundredds = addslashes($_POST['hundredds']); $totals = addslashes($_POST['totals']); $onedb = addslashes($_POST['onedb']); $fivedb = addslashes($_POST['fivedb']); $tendb = addslashes($_POST['tendb']); $twoodb = addslashes($_POST['twoodb']); $fiftydb = addslashes($_POST['fiftydb']); $hundreddb = addslashes($_POST['hundreddb']); $totalb = addslashes($_POST['totalb']); // multiple recipients $to = 'mvolz@ventronicpcsys.com' . ', '; // note the comma // subject $subject = "$location $month $day $year"; // message $message = ' <html> <head> <title><?= ("$location Cash Sheet $month $day $year") ?></title> </head> <body> <p><?php echo $location; ?></p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mellisa Mathewson ' . "\r\n"; $headers .= 'From: Totalcom <cashsheet@totalcom.us>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); header( 'Location: index.php' ); ?> I have tryed so many different combinations of php but i need to have all of those dollar amounts to be dynamic by how much each store is putting in. I don't really have a good book source for me to use, I just have my buddy Google. Thanx guys. Quote Link to comment Share on other sites More sharing options...
Ventu Posted December 15, 2007 Author Share Posted December 15, 2007 bump.. Quote Link to comment Share on other sites More sharing options...
Cep Posted December 17, 2007 Share Posted December 17, 2007 You mean you want the variables you assigned earlier to appear in the html output that you use in $message. Well if you look at the code you found you will see that it is already done, <p><?php echo $location; ?></p> All you need to do is take the line above (less the paragraph tags) and change the output variable $location to whatever variable you assigned earlier on in your code and place it in the desired location on your HTML output in $message. And the best manual for PHP, is THE manual for PHP http://www.php.net/manual/en/index.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.