sottise Posted March 14, 2006 Share Posted March 14, 2006 I'm trying to finish off a basic order form for a client site to use, using PHP to process. I am essentially completing someone else's project, so I'm in a leeeetle bit over my head. I can print the results easily enough to the confirmation page, and I have the basics of the email down - it actually sends, returns contact name / address / total cost correctly and so on. My problem comes from the one bit of code that actually requires a brain cell - returning the number of actual items ordered. On the order form, the user enters the desired quantity of each item, and the form calculates the cost. The item (item_BLEH) and the quantity (num_BLEH) need to be returned to the confirmation page and sent off in an email.Currently this is all generated as below, which works fine for the confirmation page, but I'm having a minor brain malfunction and can't figure out how to get the list into an email.How it looks:[code]function OrderedItems(){$complete = GetEntryPairs();foreach ( $complete as $name=>$value ){ print "{$name} == {$value} <BR>\n";}}function GetEntryPairs(){ global $_POST; $complete_entries = array(); foreach ( $_POST as $name=>$value ) { if ( Preg_Match("/^num_/i", $name) ) { continue; } else if ( Preg_Match("/^item_/i", $name) ) { $t_name = Preg_Replace("/^item_/i", "", $name); $amt = IntVal($_POST["num_{$t_name}"]); if ( $amt > 0 ) { $complete_entries[$t_name] = $amt; } } } return $complete_entries;}[/code]OrderedItems(); generates a list along the lines of Muffins == 5 SausageRolls == 8 which is all I really need at the moment. As I said, it works fine on the confirmation page, but I need to get that data into an email somehow, and I'm kinda stuck.This is a very very very simple form, with no database connectivity. I'll be pushing to implement a decent system (damn bureaucracy) so I won't have to touch this stuff again, but for now I really need to get this working. Any help would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/4881-mailing-form-results/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.