Jump to content

do while across multiple cells


melaniecarr23

Recommended Posts

I am creating a form from a main table.  Some of the fields in that table will be populated from information in another table (table2).

 

On the form, I created a radio button with the value set to the ID of table2, and the text following that as the label.

My problem is that I'd like the data to span several columns, say 5 items in the first column, 5 in the second, and the rest in the 3rd.

 

Here is the code I used to populate the form:

 

<tr><td>Select one:</td><td><?php do { ?><input name="mom_ed" type="radio" value="<?php echo $row_degree['degreeID']; ?>" /><?php echo $row_degree['degree']; ?><?php } while ($row_degree = mysql_fetch_assoc($degree)); ?></td></tr>

 

Can someone help me figure out how to do this?

 

Thanks!  :D

Link to comment
https://forums.phpfreaks.com/topic/247611-do-while-across-multiple-cells/
Share on other sites

I'm not sure if this is what you mean, that explanation was more than confusing, but I'll give it a go:

 

you want to pull out five records from your database and create a radio button for each???

 

$q = mysql_query("select `degreeID` from `table2` order by `degreeID` limit 5",$conn);
while($r = mysql_fetch_assoc($q)){
    echo '<input name="mom_ed" type="radio" value="'.$r['degreeID'].'">  '.$r['degreeID'].'<br />';
}

 

???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.