hi all,
i want to pass the value selected by radio button to url. so please help me. thank u..

<?php
ob_start();
@session_start();
require_once ("check.php");
$con=mysql_connect("10.70.1.50","invensis","invensis");
if(!$con)
    {
             die('Could not connect: ' . mysql_error());
    }
mysql_select_db("database_myproject",$con);
$query= mysql_query("SELECT projectassign FROM projectassign where userid=(select userid from users where username='$username' and role='2')");
mysql_error();
$num=mysql_num_rows($query);
mysql_close($con); 
 ?>
 <head>
 <body>
 <script language="javascript" type="text/javascript">
        function check()
        {
            if(document.getElementById('radio[]').value == "")
            {
                alert('Please select project');
                return false;
                
            }
        }
        </script>
 <form action="upload.php" method="POST">
 <table width="100%">
<tr><td><img src="Logofinalcopy.gif">
</td></tr>
    <tr>
        <td bgcolor="aqua"><h2>User</h2></td>
    </tr>
 </table>
 <table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 500px">
 <tr>
 <th></th>
 <th>projectassign</th>
 </tr>
 <?php
     $sno=1;
    while($row=mysql_fetch_array($query, MYSQL_ASSOC)){
?>
 <tr>
    <td><input name="radio" type="radio" id="radio[]" checked="checked" value="<?php echo $row['projectassign'];?>"></td> 
    <td><?php echo $row['projectassign'];?></td>
    
 </tr>
 <?php
   $sno=$sno+1;   
}
?>
 </table>
 <input type="submit" name="Submit"  value="Submit">
 </body></head>

So you want the value to be sent along with the rest of the form?

This should work, although your better off adding a text value to the radio button to start off with so you can be sure the data is being sent.

Could you elaborate on the question. Sounds like line 29 should be as follows

<form action="upload.php" method="GET">

But I could be wrong as you haven't explained your question with enough detail.
Also when sending pm's to me please just send a pm with a link to your topic page and possibly a quote from the first post as it is a lot more easier replying to forum topics than it is replying to pm's.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.