Hi so i have a table created and it is to display the users age in column one, then in the second column half of the age and the last column is to display double the age. I know how to do this part, however the next part is to increment the users age by 10 and display these answers in the following row, then to increment the age by 20 and display the answers etc. I have no idea how i can increase the number. The way i have it done is creating new variables however it's alot of code and i was assuming there must be another way to do this. Can anyone tell me how to do this. here's the code for the table that i have.

$halfAge = $theAge / 2;
         $doubleAge = $theAge * 2;
         $plusTen = $theAge + 10;
         $halfTen = $plusTen / 2;
         $doubleTen = $plusTen * 2;

        echo "<table>";
        echo "<tr>";
        echo "<th>Age </th>";
        echo "<th> Twice Age </th>";
        echo "<th> Half Age </th>";
        echo "</tr>";
        echo "<tr>";
        echo "<td> $theAge </td>";
        echo "<td> $doubleAge </td>";
        echo "<td> $halfAge</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td> $plusTen </td>";
        echo "<td> $doubleTen </td>";
        echo "<td> $halfTen </td>";
        echo "</tr>";
        echo "</table>";

Recommended Answers

All 2 Replies

This tutorial may help you Click Here

Thanks it helped a lot :)

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.