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++;
}

?>

Recommended Answers

All 2 Replies

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>

Thank You very much! This gives me an idea where to go.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.