Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4100342
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:33:15+00:00 2026-05-20T20:33:15+00:00

Once it loads in my page, if nothing has been saved in the DB

  • 0

Once it loads in my page, if nothing has been saved in the DB table, all options are shown. As soon as i make a selection and reload the page, the selected option dissapears from the list and isn`t reloaded in the dropdown. Instead, it displays the next value which takes the place of the selected one.

if i check the SQL statement and the $str, it does load all the options except the one which is selected which is in $getBris (it has a value).

What could be causing my select to not display my selected option and instead removing it from the list?

*It specifically doesnt work in IE8, wasnt working in Firefox but now it does

<script src="validation.js" type="text/javascript"></script>

<html>
<body onLoad="checkSecondValue();">
</body>
</html>
<?php
    //retrieve all the bris for the drop down
include '../../inc/database.php';
// ORDER BY RAND()

$res = BbqcDatabase::getInstance()->doQuery('SELECT * FROM T_TOURNOI_BRIS');
$str = "<select name='ddlBrisSelected' id='ddlBrisSelected' onChange='checkSecondValue()'>";

$getBris = $_GET['bris'];
$getBris = $getBris - 1;
print_r("bris is : "+ $getBris);


if($getBris == null)
{
    $str .= "<option value='' selected></option>";
}
else
{
$str .= "<option value='999'>Choisir un bris</option>";
}

$i = 0;

while($data = mysql_fetch_assoc($res))
{
    if($data['F_BRISID'] == $getBris)
    {
        $str .= "<option value='" . $data['F_BRISID'] . "' selected '>" . $data['F_BRISTITLE'] . "</option>";
    }
    else 
    {
        $str .= "<option value='" . $data['F_BRISID'] . "'>" . $data['F_BRISTITLE'] . "</option>";
    }
    $i++;
}

if($getBris == 12)
{
    $str .= "<option value=12 selected>Autre</option>";
}
else
{
    $str .= "<option value=12>Autre</option>";
}

$str .= "</select>";

echo $str;

if(is_numeric($bris))
{
    echo "<script type=\"text/javascript\">alert('test');checkSecondValue();</script>";
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:33:16+00:00Added an answer on May 20, 2026 at 8:33 pm

    Use your browser’s View Source feature to inspect the actual HTML you are generating (which is, in fact, the only see the browser ever sees). It looks like you’re inserting random single quotes.

    Update:

    <option value='" . $data['F_BRISID'] . "' selected '>" . $data['F_BRISTITLE'] . "</option>"
    

    … will render as:

    <option value='blah' selected '>blah</option>
    

    It’s the only error I’ve cared to spot but an HTML validator should find them all. Also, I recommend you use this syntax:

    <option value="blah" selected="selected">blah</option>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code will always make my aspx page load twice. And this has nothing
I would like for the pop up to appear once the page loads, without
What I'm trying to do: Create a 'grid' once the page loads with some
I have a page where I load a table of information using ajax. Once
Once all three loads are complete... $(#sidebar a).live(click, function(e){ $(this).addClass(selected loading); $(#conceptual).load(conceptualUrl, null, function(){
I have a 'tabbed' style web page where once the page loads each tab
I have an image that I want to fade in once the page loads.
Am building an app using Django as my workhorse. All has been well so
I have this page which loads quotes. It has a search form wherein if
In my page load, am I calling ReturnStuff() once or three times? If I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.