0
I'm very new to PHP or any type of web programming for that matter. I need the to put the following script into two columns or possibly a table with two columns. I need Fahrenheit as the heading for one column and celsius as heading for the other? It took me all night to just get what I have and my brain can't take anymore.Respectfully 

<?php
$fTemp = 0;
while ($ftemp <= 100) 
{
$cTemp = ($fTemp - 32) * .55;
echo $fTemp. " Fahrenheit is equal to ".$cTemp."
Celsius<br />";
$fTemp++;
}

?>

2
Contributors
2
Replies
19
Views
3 Years
Discussion Span
Last Post by burt.munn
0

Hello,

you probably want something like this:

<?php

$temps = range(0, 100);

?>

<table>
    <thead>
        <tr>
            <th>Fahrenheit</th>
            <th>Celsius</th>
        </tr>
    </thead>
    <tbody>
        <?php

        if(count($temps) > 0)
        {
            foreach($temps as $F)
            {

                $C = ($F - 32) * 0.55;

                echo "
                <tr>
                    <td>{$F}</td>
                    <td>{$C}</td>
                </tr>
                ";
            }
        }
        else
        {
            echo "
                <tr>
                    <td></td>
                    <td></td>
                </tr>
                ";
        }

        ?>
    </tbody>
    <tfoot>
        <tr>
            <td></td>
            <td></td>
        </tr>
    </tfoot>
</table>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.