title: set $_POST value when radio button is selected
body: <p>I have a page with some radio buttons and form. When I select one radio button I need its id to be set to $_POST['id'] varible so when I submit the form I can check which radio button was selected and act accordingly. I know I can't do it directly so tried using </p>
  
  <pre><code>onclick="document.getElementById("id").value="'.$row['id'].'"
  </code></pre>
  
  <p>on radio button but it didn't work.
      
  
  <pre><code>$d="select * from {$_c['dbprefix']}card where active='1' order by s_sent desc, s_order asc limit 0,{$_c['filtr']['step']}";
  $r=mysql_query($d);
  if (mysql_num_rows($r)&gt;0) {
  
  echo '&lt;div class="cards"&gt;';
  echo '&lt;form method="POST"&gt;';
  $i=0;
  while ($row=mysql_fetch_array($r)):
  
  echo '&lt;div class="item"&gt;';
  echo '&lt;input id="'.$row['id'].'" type="radio" name="id" class="detail"&gt;'.$_l['detailtitle'].'&lt;/input&gt;';
  echo '&lt;label for="'.$row['id'].'" class="itemin" style="height:'.$_c['card']['sy'].'px"&gt;&lt;img src="pub/cards/'.$row['id'].'s.jpg" /&gt;&lt;/lable&gt;';
  echo '&lt;/div&gt;';
  
  $i++;
  if ($i%3==0) echo '&lt;div class="cl-left"&gt;&lt;/div&gt;';
  
  endwhile;
  
  echo '&lt;div class="cl-left"&gt;&lt;/div&gt;';
  echo '&lt;/div&gt;';
      }
  ?&gt;
  
  
  
  &lt;div class="dvasl"&gt;
  
  &lt;div class="sl1"&gt;
  
  &lt;fieldset&gt;
  &lt;legend&gt;Saatja andmed&lt;/legend&gt;
  &lt;table class="info"&gt;
  &lt;colgroup&gt;&lt;col width="12%"&gt;&lt;col&gt;&lt;/colgroup&gt;
  &lt;tr&gt;
  &lt;th&gt;Nimi:&lt;/th&gt;
  &lt;td&gt;&lt;input type="text" name="item[from_name]" value="&lt;?php echo $ap['set']['from_name']; ?&gt;" class="inpedit"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;th&gt;Email:&lt;/th&gt;
  &lt;td&gt;&lt;input type="text" name="item[from_email]" value="&lt;?php echo $ap['set']['from_email']; ?&gt;" class="inpedit"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/fieldset&gt;
  
  &lt;fieldset&gt;
  &lt;legend&gt;Saaja andmed&lt;/legend&gt;
  &lt;table class="info"&gt;
  &lt;colgroup&gt;&lt;col width="12%"&gt;&lt;col&gt;&lt;/colgroup&gt;
  &lt;tr&gt;
  &lt;th&gt;Nimi:&lt;/th&gt;
  &lt;td&gt;&lt;input type="text" name="item[to_name]" value="&lt;?php echo $ap['set']['to_name']; ?&gt;" class="inpedit"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;th&gt;Email:&lt;/th&gt;
  &lt;td&gt;&lt;input type="text" name="item[to_email]" value="&lt;?php echo $ap['set']['to_email']; ?&gt;" class="inpedit"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/fieldset&gt;
  
  &lt;/div&gt;
  &lt;div class="sl2"&gt;
  
  &lt;fieldset&gt;
  &lt;legend&gt;E-kaardi tekst&lt;/legend&gt;
  &lt;table class="info"&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;textarea name="item[text]" cols="20" rows="8" class="inpedit2"&gt;&lt;/textarea&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/fieldset&gt;
  
  &lt;/div&gt;
  
  &lt;div class="cl-left"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="buttons"&gt;
  &lt;div class="t2"&gt;&lt;input type="submit" value="Vaata kaardi eelvaadet" name="button[nahled]" class="unbutt1"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;input type="hidden" name="id" value="&lt;?php echo $ap['card']['id']; ?&gt;"&gt;
  &lt;input type="hidden" name="action" value="itemadd"&gt;
  &lt;/form&gt;
  
  &lt;?php
  $k=floor(($i-1)/3);
  if ($k&lt;2) echo '&lt;div class="spacer-'.(2-$k).'"&gt;&lt;/div&gt;';
  
  ?&gt;
  </code></pre>