Hi there i currently want to create a function for my project.
The thing i am trying to do here is grab the compid from each row of my table and when the user clicks the button thats on the end of each row to enter the team into that competition if that makes any sense.
How would i go about doing this would i have to code the function into the loop so that the compid would be the same for each row or is there another way ??
hope this makes sense my code is below thanks.
<h1>Manage Competitions</h1></div>
</div>
<h2> </h2>
<p> List of competitions team can enter in:</p>
<table width="500" border="1" cellspacing="0" cellpadding="3">
<tr>
<td width="10%"><h2><strong>CompID</strong></h2></td>
<td width="35%"><h2><strong>Comp Name</strong></h2></td>
<td width="10%"><h2><strong>Min Teams</strong></h2></td>
<td width="10%"><h2><strong>Max Teams</strong></h2></td>
<td width="35%"><h2><strong>Comp Type</strong></h2></td>
</tr>
<p><?php
// Retrieve data from database
$Query="SELECT * FROM $tbl_comp";
$result=mysql_query($Query);
// loops so all the data from the database will be added
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td width="10%"><?php echo $rows['compid']; ?></td>
<td width="35%"><?php echo $rows['compname']; ?></td>
<td width="10%"><?php echo $rows['minteams']; ?></td>
<td width="10%"><?php echo $rows['maxteams']; ?></td>
<td width="30%"><?php echo $rows['comptype']; ?></td>
<td width="5%"><input type="button" onclick="entercomp()" value="enter" /> </td>
</tr>
<?php
// loop had to be closed after the table because the table wasnt being populated.
}
mysql_close();
?>
</table></p>
<p> </p>
thanks for taking the time to look