Jump to content

Recommended Posts

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:

 

<?
$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);
}
?>



 

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

Link to comment
https://forums.phpfreaks.com/topic/238485-bring-back-the-focus-item-to-form/
Share on other sites

By sticky you mean?

 

I understand focus as when the page loads, the active object is that with focus. Like loading up google.com - focus is given to the query input so you can just start typing, rather than clicking on the input box and then typing.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.