mrjameer Posted December 19, 2006 Share Posted December 19, 2006 hi,i have a table.it's structure is like thisitemno--itemname--price1--abc--2002--djh--3003--eee-400i want to dynamically create 3 radio buttons for prices and to display these records on web page and when a user click radio button of any one the selected values should be stored in some other table.how to do this.i know how to display and store in db.problem is with dynamically creating radio buttons.please any of your help is appreciated.thanksmrjameer Quote Link to comment https://forums.phpfreaks.com/topic/31256-problem-with-radio-button/ Share on other sites More sharing options...
.josh Posted December 19, 2006 Share Posted December 19, 2006 [code]// example retrieval of all info in your db$sql = "select * from table";$result = mysql_query($sql) or die(mysql_error());while ($list = mysql_fetch_array($result)) { // make a radio button with the item name next to it. radio button will // pass all of the info associated with the item as an array called [itemname] echo "<input type='radio' name='{$list['itemno']}' value='{$list}'>{$list['itemname']}<br/>";} [/code] Quote Link to comment https://forums.phpfreaks.com/topic/31256-problem-with-radio-button/#findComment-144602 Share on other sites More sharing options...
simcoweb Posted December 19, 2006 Share Posted December 19, 2006 Please post your code you have now for summoning and displaying your products :) Quote Link to comment https://forums.phpfreaks.com/topic/31256-problem-with-radio-button/#findComment-144603 Share on other sites More sharing options...
JP128 Posted December 19, 2006 Share Posted December 19, 2006 [code]<?php//Connect to DB here$sql = mysql_query(\"SELECT * FROM `tablename`\");?><form method=\"PAGE HERE\" action=\"\"><?phpwhile($row = mysql_fetch_assoc($sql)){echo\"<input type=\'radio\' value=\".$row[\'price\'].\" name=\'\".$row[\'itemno\'].\"\'>\".$row[\'itemname\'];}?></form><?php//Of course, you will need to change some of the information, but that is the basic structure.?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31256-problem-with-radio-button/#findComment-144607 Share on other sites More sharing options...
JP128 Posted December 19, 2006 Share Posted December 19, 2006 ok, i dont know what happened with all of those escape slashes, but they shouldn\'t be there. Quote Link to comment https://forums.phpfreaks.com/topic/31256-problem-with-radio-button/#findComment-144613 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.