0

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>
3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by cwarn23
0

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.

0

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.

This topic has been dead for over six months. 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.