//flex table opened by JP

Click to See Complete Forum and Search --> : PHP question


cesc
09-15-2007, 01:55 PM
Hi. I am your occasional webmaster who tries to get his hands dirty from time to time. My newest adventure is a simple online ordering system for the company I work for. Here's what I am doing:
http://www.neatrading.com/bla.html

I want to use php to get the form's contents and e-mail it to one of the girls in the office so that they can write the invoices.

The customer will put numbers in front of the items they need, and leave whatever they don't need blank.

While doing some experiments, I was able to build a page with the customer's information, but it was terribly boring (the page and the code, but right now I am worried about the code).

Here's the php:

<html>
<head>
<title>Review your order</title>
</head>
<body>
<b>Please, review your order.</b>
<br><br>
<?php
extract($_POST);
echo "<b/>CUSTOMER: </b/>" .$CUSTOMER ."<br/>";
echo "<b/>PHONE: </b/>" .$PHONE ."<br/>";
echo "<b/>FAX: </b/>" .$FAX ."<br/>";
echo "<b/>DATE: </b/>" .$DATE ."<br/>";
echo "<b/>P.O.#: </b/>" .$PO ."<br/>";
?>
</body>
</html>


Notice how I use echo 3413282473 times. Now image what it is going to look like for all those items I have on the html file.

Can anybody give me suggestions code wise? Thanks.

delRhode
09-15-2007, 03:28 PM
I won't go into great detail, but you might consider looking into the "foreach" construct, and apply that against $_POST, or an intermediary array of descriptions and keys. www.php.net is your friend... :)

slam
09-19-2007, 07:39 PM
Would you want to consider mysql table for the info and a html invoice that your end user can print?

if so you could use and an echo and a loop variable