Help with code
Posted: Sun Jun 05, 2011 8:47 am
Hello All,
I have a code I am struggling and hoping someone can show me the error in my ways, This is from a form that posts the results to a database. Everything works except one thing. When I go back to the form, the focus is not the selection of what is in the database. Here is the code:
So basically, when I bring the form back up, it brings up the list of players, which it should incase the user wants to change the player, but it does not focus to the player that the user has already chosen.
Thanks for any help.
Patsman77
I have a code I am struggling and hoping someone can show me the error in my ways, This is from a form that posts the results to a database. Everything works except one thing. When I go back to the form, the focus is not the selection of what is in the database. Here is the code:
Code: Select all
<?
$con3= mysql_connect("localhost","xxxxxxxx","xxxxxxx");
mysql_select_db("swammisp_football", $con3);
$sql2="select * from signups WHERE Name='$_SESSION[user]' AND Fantasy='Yes'";
//echo "$sql2<br>";
$infantasy=mysql_query($sql2) or die (mysql_error());
mysql_select_db("swammisp_football", $con3);
$sql="select qb from Fantasy WHERE User='$_SESSION[user]' AND Week=$week";
$result=mysql_query($sql);
if (mysql_num_rows($infantasy) == 0){
echo "<option value=\"OUT\">Not in pool</option>";
}
else{
$sql3="select qb from Fantasy WHERE user='$_SESSION[user]' AND Week=$week";
$result2 = mysql_query($sql3);
if (mysql_num_rows($result2) == 0){
$pick = "XXX";
echo "<option value=\"BAD\" selected>PICK</option>";
}
else {
$sql=mysql_fetch_object($result2);
$team = $sql->qb;
}
$sql="select Player from QB";
$result=mysql_query($sql);
while ($sql = mysql_fetch_object($result))
{
// echo $sql->vid . " (against " . $sql->hid . ")<BR>";
$qbout[$sql->Player] = "<option value=\"$sql->Player\"" . checkpick($sql->Player, $Player) . ">$sql->Player</option>";
}
sort($qbout);
foreach ($qbout as $team){
echo $team;
}
//mysql_free_result($result);
}
?>Thanks for any help.
Patsman77