Jump to content

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 />';
}

 

???

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.