Rahima farzana.S
Rahima farzana.S

Reputation: 37

inserting radio button in php page

I have retrieved the database details from a database to a php page. i have actually retrieved a specific column of a query. but i am not able to add the radio buttons to the retrieved values. Following is my coding:

<?php
    $query  = "SELECT url FROM measurementurl";
    $result = mysql_query($query);

    while($row = mysql_fetch_row($result))
    {
        $url  = $row[0];
        echo "url :$url <br>" ;
    } 
?> 

Upvotes: 1

Views: 399

Answers (1)

Gajahlemu
Gajahlemu

Reputation: 1263

Try this:

<form action="">
<?php
    $query  = "SELECT url FROM measurementurl";
    $result = mysql_query($query);

    while($row = mysql_fetch_row($result))
    {
        //$url  = $row[0]; removed cause not used in code
        echo "<input type=\"radio\" name=\"url\" value=\"$row[0]\" />$row[0]<br />";
    } 
?> 
</form>

Upvotes: 2

Related Questions