will35010 Posted June 23, 2009 Share Posted June 23, 2009 Me and a friend wrote this application for reserving seats at a playhouse. He wrote the below script and I am lost on it. I want it to display the seats as 4 in left table, 4 in center table, and 4 in the right table. The seating arrangement is A1 - A12 to J1 - J12. Here is the link to the testing site so you can see what it is doing. http://www.trilakesmc.com/test/php-seat/ <?php session_start(); require 'include/config.php'; require 'include/opendb.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Panola Playhouse</title> <link rel="stylesheet" type="text/css" href="form/view.css" media="all"> <script type="text/javascript" src="form/view.js"></script> <script type="text/javascript" src="include/formvalidation.js"></script> <script type="text/javascript" src="include/seats.js"></script> <style type="text/css"> table.seats { border-width: 0px 0px 0px 0px; border-spacing: 1px; border-style: hidden hidden hidden hidden; border-color: black black black black; border-collapse: separate; } table.seats td { border-width: 0px 0px 0px 0px; padding: 4px 4px 4px 4px; border-style: hidden hidden hidden hidden; border-color: black black black black; -moz-border-radius: 0px 0px 0px 0px; text-align: center; width: 30px; } table.seats td.available { background-color: lightgreen; } table.seats td.reserved { background-color: #FFFF00; } table.seats td.empty { width: 15px; } .style1 {font-size: 16px} </style> </head> <body id="main_body" > <img id="top" src="form/top.png" alt=""> <div id="form_container"> <h1><a>Panola Playhouse</a></h1> <form id="form_102705" class="appnitro" name="seat" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <div class="form_description"> <h2>Panola Playhouse</h2> <p></p> </div> <div align="center"> <?php if (isset($_POST["times"]) || isset($_POST['event'])) { if (isset($_POST["times"])) { $eventID = $_POST["times"]; } else { $eventID = $_POST['event']; } $allSeatsQuery = "SELECT * from seats order by rowID, colID desc"; if ($allSeatsResult = mysqli_query($conn, $allSeatsQuery)) { $prevRowId = null; $tableRow = false; echo "<input type='hidden' name='event' value='{$eventID}'/>"; $number = 10; $six = true; while (list($seatID, $rowID, $colID) = mysqli_fetch_row($allSeatsResult)) { if ($prevRowId != $rowID) { if ($rowID != 'A') { echo "\n </tr>\n</table>"; } $prevRowId = $rowID; echo "\n<table class='seats'>\n <tr>"; } else { $tableRow = false; } if ($seatID == $number) { if ($six) { $number -= 6; $six = false; } else { $number += 20; $six = true; } echo "<td class='empty'></td>\n"; } $reservedSeatsQuery = "SELECT seatLock, customerID FROM reservations WHERE seatID = ".$seatID." AND eventID = ".$eventID; if ($reservedSeatsresult = mysqli_query($conn, $reservedSeatsQuery)) { $row = mysqli_fetch_row($reservedSeatsresult); if (empty($row) || ($row[0] < time() && $row[1] == 0)) { if (!empty($row)) { $deleteReservationQuery = "DELETE FROM reservations WHERE seatID = ".$seatID." AND eventID = ".$eventID; mysqli_query($conn, $deleteReservationQuery); } echo "\n\t<td class='available'>"; echo "$rowID$colID"; echo "<br /><input type='checkbox' name='seats[]' value='$rowID$colID'></checkbox>"; } else { echo "\n\t<td class='reserved'>"; echo "$rowID$colID"; if ($row[0] === session_id()) { echo "<input type='checkbox' name='seats[]' value='$rowID$colID'></checkbox>"; } } echo "\n\t</td>"; } else { die("Cannot retrieve reservation count"); } } echo "\n </tr>"; echo "\n</table>\n"; } else { die ("Cannot retrieve Seat data."); } } else { echo "You must select a show time."; } require 'include/closedb.php'; ?> <br/> <table class='seats'> <tr> <td class='available'>Available</td> <td class='reserved'>Reserved</td> </tr> </table> <br/> <table> <tr> <td> <input type='button' value='Refresh View' onclick='refreshView();'/> <input type='button' value='Reserve Seats' onclick='reserveSeats()'/> <input type='button' value='Clear Selection' onclick='clearSelection()'/> </td> </tr> </table> <p align="center"><a href="seatplan.jpg" target="_blank" class="style1">View Seat Plan </a></p> </form> <br/> </div> <div id="footer"> Software by Will Morris & Daniel Cerveny</a> </div> </div> <img id="bottom" src="form/bottom.png" alt=""> </body> </html> <!--</body> </html>--> Link to comment https://forums.phpfreaks.com/topic/163380-solved-php-echo-formathtmlcss/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.