Hi, thanks to Petr.pavel I managed to get my array to have checkboxes but my problem is that the form uses php_self and so where do i use the insert query to insert to DB. I dont want page refreshes.

I usually put the insert query in a php file and point the form action to that. I also have to add a username + password + comp_id field to the form or could i add these to the first form. here is the code below that i have so far, the form echos after a round ($q) is picked from a drop down list.

Select a Round:
<select name="round" onchange="showRound(this.value)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>


$con = mysql_connect('localhost', 'user', 'pass');
if (!$con)
die('Could not connect: ' . mysql_error());

mysql_select_db("realt905_realtipper", $con);

$sql="SELECT * FROM fixtures WHERE round = '".$q."'";

$result = mysql_query($sql);
echo "<table border='0'>
<th align='center'>Home</th>
<th align='center'>Away</th>

while($row = mysql_fetch_array($result))
echo '<form action="<?php $PHP_SELF; ?>" method="POST">';
echo '<tr>';
echo "<td width='25' align='center'>" . $row . "</td>";
echo '<td><input type="checkbox" name="home" value="'.$row.'">' . $row . '</td>';
echo '<td><input type="checkbox" name="away" value="'.$row.'">' . $row . '</td>';
echo '</tr>';
echo '</form>';
echo "</table>";
echo '<input type="submit">';

10 Years
Discussion Span
Last Post by nav33n

echo '<form action="<?php $PHP_SELF; ?>" method="POST">';

This is wrong. Use this instead. echo '<form action='.$_SERVER['PHP_SELF'].' method="POST">';

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.