3
Contributors
6
Replies
21
Views
1 Year
Discussion Span
Last Post by diafol
-1

i want know how to get data from database using radio buttons. please help me out

-1

i dnt hve idea how to fetch data from database using radio buttons

0

A downvote will not lead help, at least from me. I asked you to share what have you done or do I have to write your code without knowing what you really need?

Try to share your form, your receiving script, your query to the database table and maybe then we will be able to suggest you what to do.

0

$con = @mysql_connect('localhost', 'root', '');

    $con = @mysql_connect('localhost', 'root', ''); 
   if (!$con) { 
   die( '<p>Unable to connect to the ' . 
          'database server at this time.</p>' ); 
   } 

   // Select the database 
   if (! @mysql_select_db('cars', $con) ) { 
   die( '<p>Unable to locate the cars ' . 
          'database at this time.</p>' ); 
   } 

   { 
   $result = mysql_query('select * from cars'); //display the database results 
   while($row=mysql_fetch_row($result)) 
   { 
      $Cargroup=$row['Cargroup']; 
      $CarType=$row['CarType']; 
      $Rate=$row['Rate']; 
      $Fee=$row['Fee']; 


echo '<tr> 
        <td> 
         <input type="radio" name="vehicle" value="group"> 
        </td> 
        <td> 
         '.$row['Cargroup'].' 
        </td> 
        <td width="100%"> 
         '.$row['CarType'].' 
        </td> 
        <td> 
         '.$row['Rate'].' 
        </td> 
        <td> 
         '.$row['Fee'].' 
        </td> 
        <td> 
         '.$row['Fee'] + $row['Rate'].' 
        </td> 
     </tr>'; 
    }
    mysql_close($con);

?>

die( '<p>Unable to connect to the ' .

          'database server at this time.</p>' );  $con = @mysql_connect('localhost', 'root', ''); 
   if (!$con) { 
   die( '<p>Unable to connect to the ' . 
          'database server at this time.</p>' ); 
   } 

   // Select the database 
   if (! @mysql_select_db('cars', $con) ) { 
   die( '<p>Unable to locate the cars ' . 
          'database at this time.</p>' ); 
   } 

   { 
   $result = mysql_query('select * from cars'); //display the database results 
   while($row=mysql_fetch_row($result)) 
   { 
      $Cargroup=$row['Cargroup']; 
      $CarType=$row['CarType']; 
      $Rate=$row['Rate']; 
      $Fee=$row['Fee']; 


echo '<tr> 
        <td> 
         <input type="radio" name="vehicle" value="group"> 
        </td> 
        <td> 
         '.$row['Cargroup'].' 
        </td> 
        <td width="100%"> 
         '.$row['CarType'].' 
        </td> 
        <td> 
         '.$row['Rate'].' 
        </td> 
        <td> 
         '.$row['Fee'].' 
        </td> 
        <td> 
         '.$row['Fee'] + $row['Rate'].' 
        </td> 
     </tr>'; 
    }
    mysql_close($con);

?>
0

OK:

1) Do not post multiple nonsense threads - somebody has to clean up your s***.
2) Post a meaningful question - read this - pritaeas' "Read This" for posting PHP related questions
3) Learn to press the right voting keys - thumb up = agree / I want help, thumb down = disagree / p*** off
4) Stop using deprecated code - mysql_* functions are dead. See DW Tutorial: Common Issues with MySQL and PHP
5) Only post your code once - I don't understand why you posted it twice. Copy and paste ain't that difficult.

Edited by diafol

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.