Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    radio, 1° valore sempre chekkato

    ciao,

    estraggo dal DB i dati con un while e li abbino ad un bottone radio.
    Come faccio a fare in modo che il radio del 1° valore estratto sia sempre checkkato?


    Codice PHP:
    $query "SELECT * FROM tabella";
       
    $result dbQuery($query) or die (mysql_error());
         while(
    $row mysql_fetch_array($result)){
            echo
    "<input type=\"radio\" name=\"lingua\" value=\"{$row['dato']}\" />"$row['dato']; 
    dènkiu!

  2. #2

  3. #3
    Codice PHP:
    $i 0;
    while(
    $row mysql_fetch_array($result)){
            
    $checked $i==0?' checked':'';
            echo
    "<input type=\"radio\" name=\"lingua\" value=\"{$row['dato']}\"{$checked} />"$row['dato'];
            
    $i++; 
    ciao

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.