Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][MySQL][PHP]problem z polem checked="checked"
tdr
post
Post #1





Grupa: Zarejestrowani
Postów: 41
Pomógł: 0
Dołączył: 2.02.2013

Ostrzeżenie: (0%)
-----


Cześć, witam (IMG:style_emoticons/default/smile.gif)

Koledzy taki denerwujacy problem.... mam w tabeli pole rekord instruktor (int1) tam jest wartosc 0-1

i gdy ta wartość wynosi 1 pole checkbox ma być domyślnie zaznaczone i adekwatnie przy 0.

kod:
Kod
$user_id = $_SESSION['user_id'];

            $query = "SELECT * FROM users WHERE user_id = '$user_id'";

            $data = mysqli_query($dbc, $query);

            while($row = mysqli_fetch_array($data)){
                $check_instruktor = $row['instruktor'];
            }

            ?>
<input type="checkbox" name="instruktor" id="instruktor" <?php ($check_instruktor == 1) ? 'echo checked="checked"' : ""; ?> value="1">
oczywiscie to nie dziala... mozecie mi pomoc?
dokladnie taki sam problem mam z polem option w <select>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.12.2025 - 14:43