Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Payroll Form</title>
- <style type="text/css">
- /* Simple styles to make it look a little nicer */
- input {
- margin-right: 15px;
- }
- input[name*=rate], input[name*=hours] {
- width: 50px;
- }
- </style>
- </head>
- <body>
- <form method="post" action="payroll_process.php">
- Company Name: <input type="text" name="company_name">
- <br>
- Date: <input type="text" name="date">
- <br>
- <?php
- /* Same Result, less typing */
- $numOfEmployees = 5;
- for( $i=0; $i<$numOfEmployees; ++$i){
- echo '
- <fieldset>
- <h3>Employee #' . ($i + 1) . '</h3>
- Name: <input type="text" name="employee[' . $i . '][name]">
- Rate/Hour: $<input type="text" name="employee[' . $i . '][rate]">
- Hours Worked: <input type="text" name="employee[' . $i . '][hours]">
- </fieldset>';
- }
- // ($i + 1) instead of $i++, because we do not want to change $i, merely use the value of
- ?>
- <input type="submit" value="Submit">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement