Posted by ozgur teksin on 07/06/05 06:27
hi
I have a project to finish in php. I have to send some values and make
calculation through email. Actually I found the solution for sending hidden
values through email. But the solution is just a few items . If there are
alot of items i a screwed. Because i have to write a long listing code. This
doesnt make sense. Here is my code so you can understand what i mean.
a piece of my html code is
<form method="POST" action="estimate.php">
<input type="text" size="2" maxlength="3" name="item_2" class="txt2"><input
type="hidden" name="Weight_2" value="65"><input type="hidden" name="Name_2"
value="Bookshelves, per section"></td>
<td class="txt3"> Chair, Arm</td>
<td class="txt3">
<input type="text" size="2" maxlength="3" name="item_3"
class="txt2"><input type="hidden" name="Weight_3" value="60"><input
type="hidden" name="Name_3" value="Chair, Arm"></td>
</tr>
<tr>
<td class="txt3">Chair Rocker (wood)</td>
<td class="txt3">
<input type="text" size="2" maxlength="3" name="item_4"
class="txt2"><input type="hidden" name="Weight_4" value="40"><input
type="hidden" name="Name_4" value="Chair Rocker (wood)"></td>
<td class="txt3"> Chair Overstuffed</td>
<td class="txt3">
<input type="text" size="2" maxlength="3" name="item_5"
class="txt2"><input type="hidden" name="Weight_5" value="120"><input
type="hidden" name="Name_5" value="Chair Overstuffed"></td>
</tr>
<tr>
<td class="txt3">Chair Straight</td>
<td class="txt3">
<input type="text" size="2" maxlength="3" name="item_6"
class="txt2"><input type="hidden" name="Weight_6" value="25"><input
type="hidden" name="Name_6" value="Chair Straight"></td>
<td class="txt3"> Desk, Small</td>
<td class="txt3">
<input type="button" value="SUBMIT ESTIMATION REQUEST" name="submit">
my php code is ;
<?php
$FTGName_2 = $item_2 * $Weight_2;
$FTGName_3 = $item_3 * $Weight_3;
$FTGName_4 = $item_4 * $Weight_4;
$FTGName_5 = $item_5 * $Weight_5;
$FTGName_6 = $item_6 * $Weight_6;
$FTGtotal = $FTGName_2 + $FTGName_3 + $FTGName_4 + $FTGName_5 + $FTGName_6;
$body = "$Name_2 : $FTGName_2\n"
. "$Name_3 : $FTGName_3\n"
. "$Name_4 : $FTGName_4\n"
. "$Name_5 : $FTGName_5\n"
. "$Name_6 : $FTGName_6\n"
?>
if there is not alot of item it is fine. But what if i have hundred item.
How am i going to calculate. I use some for loop but i didnt work very well.
Can somebody help me please. I m going crazy over here.
Thanks in advance
[Back to original message]
|