WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   radiobuttons per PHP als checked setzen? (http://www.wcm.at/forum/showthread.php?t=106745)

käptn 26.08.2003 20:07

Mal allgemein zum Zugriff:

PHP-Code:

$rs mysql_query(...);

$row0 mysql_fetch_object($rs);

echo 
$row0->spalte0;
echo 
$row0->spalte1;
//...

$row1 mysql_fetch_assoc($rs);

echo 
$row1['spalte0'];
echo 
$row1['spalte1'];
//...

$row2 mysql_fetch_array($rs);

echo 
$row[0];
echo 
$row['spalte1'];
//... 

~

row 27.08.2003 10:47

Hurreka
 
Hi Leute - es funktioniert - super, danke!!!!
So hat's nun funktioniert:

Das PHP Script:
<?PHP
$abfrage = "SELECT playful FROM tels WHERE session=$survey_id";
$ergebnis = mysql_query($abfrage);
$ausgabe = mysql_fetch_object($ergebnis);
$eingabe=$ausgabe->playful;
?>

Und der HTML code zum Checkbox setzen:
<TR>
<TD></TD>
<TD align=center><input type="radio" name="playful" value="0" <?php if ($eingabe =="0") {echo"checked";} ?>> 0</TD>
<TD align=center><input type="radio" name="playful" value="1" <?php if ($eingabe =="1") {echo"checked";} ?>> 1</TD>
<TD align=center><input type="radio" name="playful" value="2" <?php if ($eingabe =="2") {echo"checked";} ?>> 2</TD>
<TD align=center><input type="radio" name="playful" value="3" <?php if ($eingabe =="3") {echo"checked";} ?>> 3</TD>
</TR>

row 27.08.2003 13:56

@Sesa_Mina

Ich habe jetzt Deinen Code auch noch ausprobiert und mit einer while Schleife spart man sich da viel Tiparbeit, danke!


Alle Zeitangaben in WEZ +2. Es ist jetzt 01:11 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag