title: Radio Button List
body: <p>I wonder whether someone may be able to help me please.</p>
  
  <p>I'm using the code below to construct a list with a radio button as a way of selecting each row of data.</p>
  
  <pre><code>&lt;?php
  
  mysql_connect("hostname", "username", "password")or
  die(mysql_error());
  mysql_select_db("database");
  
  
  
  $result = mysql_query("SELECT userdetails.userid, finds.userid, finds.locationid, detectinglocations.locationid, detectinglocations.locationname, finds.dateoftrip, finds.findname, finds.finddescription FROM userdetails, finds, detectinglocations WHERE finds.userid=userdetails.userid AND finds.locationid=detectinglocations.locationid AND finds.userid = 1");
  if (mysql_num_rows($result) == 0)
  // table is empty
    echo 'There are currently no finds recorded for this location.';
  echo"&lt;table&gt;\n";
    while (list($userid, $dateoftrip) =
      mysql_fetch_row($result))
    {
  
      echo"&lt;tr&gt;\n"
      .
       "&lt;td&gt;&lt;input type='radio' name='radio' dateoftrip, value='{$userid}' /&gt;&lt;/td&gt;\n"
      ."&lt;td&gt;&lt;small&gt;{$dateoftrip}&lt;/small&gt;&lt;td&gt;\n"
      ."&lt;/tr&gt;\n";
    }
    echo"&lt;tr&gt;&lt;td colspan=\"3\"&gt;";
    echo"&lt;br&gt;";
    echo"&lt;/td&gt;&lt;/tr&gt;";
    echo'&lt;/table&gt;';
  
  ?&gt;
  </code></pre>
  
  <p>I can manage to construct the list but the value next to the radio button is the 'userid' whereas I'm looking to put the 'dateoftrip' against each radio button.</p>
  
  <p>I've been working on this for a while now and I can't see where my error is.</p>
  
  <p>I just wondered whether someone could perhaps take a look at this please and let me know where I'm going wrong.</p>
  
  <p>Many thanks</p>