I am attempting to create a table that consists of 2 forms where the first form gets info from the second. so i have table1 and table 2. I want to make it to be users choice . a user picks the number of rows and columns(I went up to 7 rows and columns in dropbox) and color from a drop down box and whatever they pick it generates. My problem is when I select something instead of showing me a table row and columns with the colors its showing me 1111 can anyone suggest something? Maybe my logic is wrong please help.
Code:?php $color= substr(filter_input(INPUT_GET,'color',FILTER_SANITIZE_NUMBER_INT),0,10); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="keywords" content="Table"> <meta name="description" content="table Creator"> <link rel="stylesheet" type="text/css" href="style.css"> <style> tr:nth-child(even) { background-color:#000000; color:#000000; <?php echo $color ?>; } table, th, td { border: 1px solid #000000; ; padding: 10px; } table { border-collapse: collapse; } </style> <title>table</title> </head> <body> <header> <h1> Projects</h1> </header> <nav> </nav> <section> <h2> Table Creator</h2> <?php $rows= substr(filter_input(INPUT_GET,'rows',FILTER_SANITIZE_NUMBER_INT),0,3); $cols= substr(filter_input(INPUT_GET,'cols',FILTER_SANITIZE_NUMBER_INT),0,3); echo "<Table>"; for ($x=1; $x<=$rows; $x++) { echo "<tr>"; for ($y=1; $y<=$cols; $y++) echo "<td>$rows $x $cols $y</td>"; } { echo "<tr>"; } echo "</Table>"; ?> </section> <footer> </footer> <p></p> </body> </html>


Reply With Quote


Bookmarks