Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Rich People`s Problems</title>
- <style>
- table {
- margin-top:40px;
- }
- td, th {
- padding:5px;
- }
- </style>
- </head>
- <body>
- <form action="" method="post" >
- <label for="cars">Enter Cars</label>
- <input type="text" name="cars" value="shkoda, filicia, moskvich"/>
- <input type="submit" value="Show Results"/>
- </form>
- <?php
- if(isset($_POST['cars']) && !empty($_POST['cars'])) {
- $allCars = explode(',', $_POST['cars']);
- $allColors = array('aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy',
- 'olive', 'orange', 'purple', 'red', 'silver', 'teal', 'white', 'yellow');
- $resultTable = '';
- echo "<table border='1'><tr><td>Car</td><td>Color</td><td>Count</td></tr>";
- for($i = 0; $i < count($allCars) ;$i++) {
- $color = $allColors[rand(0, 16)];
- $count = rand(1, 5);
- echo "<tr><td>$allCars[$i]</td><td>$color</td><td>$count</td></tr>";
- }
- echo "</table>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement