php sendmail表单中的变量

im a beginner in php / mysql so go easy on me :)

I made a very basic php order form for our work which has lots of dropdown boxes. This submits the results via an email using sendmail in php.

Now im trying to make it dynamic using a sql database.

I have the form set up using the sql and php, but my problem lies in the sending of the dynamically generated data.

I have all the variables available by using this line

extract($_POST['orderdetails'], EXTR_SKIP);

the variables end up as $vanilla00, $vanilla06, $vanilla11, etc...

So now I have this code to create the table using these variables

while($row = mysql_fetch_array($resultbline))

{$message   .="<tr><td>" 
. $row['prod_name'] 
. "</td><td>&nbsp;</td><td></td>
<td>$" . $row['prod_selectname'] . "0</td>
<td>$" . $row['prod_selectname'] . "6</td>
<td>$" . $row['prod_selectname'] . "11</td>
<td>$" . $row['prod_selectname'] . "18</td>
<td>$" . $row['prod_selectname'] . "t</td>
<td>$" . $row['prod_selectname'] . "24</td>
<td>$" . $row['prod_selectname'] . "36</td>" ;
} 

The prod_selectname is taken from the database and in this instance will be vanilla, so the final table ends up reading

while($row = mysql_fetch_array($resultbline))

{$message   .="<tr><td>" 
. $row['prod_name'] 
. "</td><td>&nbsp;</td><td></td>
<td>$vanilla0</td>
<td>$vanilla6</td>
<td>$vanilla11</td>
<td>$vanilla18</td>
<td>$vanillat</td>
<td>$vanilla24</td>
<td>$vanilla36</td>" ;
}

the problem is that the resulting email shows the variable name (ie vanilla18) instead of treating it as a variable.

Am I missing some . { ( [ or other code somewhere ?

Sorry to be so thorough, but I dont know how else to explain it.

Thanks in advance

That's because you are concatenating $row['prod_selectname'] as string. Before you echo each variable you need to name it dinamically, like this:

$var_name = $row['prod_selectname'] . "0";

When you echo the variable, it will be like this:

"<td>" . echo $$var_name . "</td>";

Try this:

<?php



while ($row = mysql_fetch_array($resultbline))
{

    $var1 = $row['prod_selectname'] . "0";
    $var2 = $row['prod_selectname'] . "6";
    $var3 = $row['prod_selectname'] . "11";
    $var4 = $row['prod_selectname'] . "18";
    $var5 = $row['prod_selectname'] . "t";
    $var6 = $row['prod_selectname'] . "24";
    $var7 = $row['prod_selectname'] . "36";

    $message .="<tr><td>"
            . $row['prod_name']
            . "</td><td>&nbsp;</td><td></td>
            <td>" . $$var1 . "</td>
            <td>" . $$var2 . "</td>
            <td>" . $$var3 . "</td>
            <td>" . $$var4 . "</td>
            <td>" . $$var5 . "</td>
            <td>" . $$var6 . "</td>
            <td>" . $$var7 . "</td>
";
} 

But machineaddict posted this first... So give him the credit. ;)