smccoy4 Posted July 21, 2009 Share Posted July 21, 2009 I have a table with 3 columns (10-12, 12-2, 2-4) and 11 rows(job1, job2, job3, ect...) Each cell in the table has an image link for someone to click and signup for that particular time and job slot. If someone is already signed up for that time and job slot, then the image link is no longer printed, instead the person who signed up for the slot is printed. the data is saved in the database as tent(id int auto increment, day varchar(5), name varchar(50), activity varchar(50), time varchar(15)) [ex. 1 Sun Shaun 1 1] This would translate into Day: Sunday Name: Shaun Activity: Information 2 Time: 12-2. The values for activity and time are stored in an array in the signup.php file. PROBLEM: I need to be able to pull the data from the database and insert into the table. But it has to be put into the proper place on the table meaning that it must match up with the correct row and col (job & time). I will enclose the code I have for two of the tables, one is a regular table like all the rest and the others is probably the easier of the two to fix. I have already posted this on other forums with no results. I keep getting code to simply print the data from the database, that is not what I am trying to do. I need to be able to place it in the correct location in the table. PLEASE HELP!! <html> <head> <link rel="stylesheet" type="text/css" a href="tent.css" /> <title>OIT Tent Sign-Up Sheet</title> </head> <body> <table class="setup"> <caption>Set-up and Break-down Crew</caption> <tr> <td align: center;> <b>Saturday-Tuesday</b><br/> <b>9:30-10:00 & 4:00-4:30</b> </td> </tr> <?php include('dbcon.php'); $setup_array = mysql_query("SELECT `name`,`time` FROM `tent` WHERE `day`='setup' ORDER BY `time` ASC") or die(mysql_error()); while($row = mysql_fetch_array($setup_array)) { static $time = 4; if(!empty($row['time'])) { echo "<tr><td>".$row['name']."</td></tr>"."\n"; $time++; } else { echo "<tr><td><a href='signup.php?day=4&activity=11&time=".$time."'><img border='0' src='/images/signup.gif' alt='Signup' /></a></tr></td>"; $time++; } } ?> </table> <br/> <table> <caption>Saturday</caption> <tr> <td class="job"><img border='0' src="images/Job.gif"></td> <td><b>10:00-12:00</b></td> <td><b>12:00-2:00</b></td> <td><b>2:00-4:00</b></td> </tr> <?php for ($i=0; $i<=10; $i++) { echo "<tr>"; echo "<td class='job'>" . $img[$i] . "</td>"; for ($r=0; $r<=2; $r++) { echo "<td name='Sat".$i.$r."'><b><a href='signup.php?day=0&activity=".$i."&time=".$r."'><img border='0' src='images/signup.gif'></a></b></td>"; } echo "</tr>"; } ?> </table> Link to comment https://forums.phpfreaks.com/topic/166825-php-sign-up-form/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.