LearningKid Posted December 28, 2009 Share Posted December 28, 2009 Hi can someone tell me what im doing wrong here, i tried to call a few things form i db and i got them and then add them to a dropdown menu but i keep gett (">) next to the files im sure its just something small tht i missed a hundred times so if someone has beter eyes than mine hlp is appreciated. <?php session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } echo "Hi $_SESSION[myusername] <br /><br />"; ?> <html> <body> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); ?> <form action="count.php" method="post"> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab1').style.display='block';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Pages</a></strong><br /> <div id="tab1" style="display:none; font-size:11;"> Single Sided B&W <input type="radio" name="bw/c" value="1" /><br /> Double Sided B&W <input type="radio" name="bw/c" value="2" /><br /> Single Sided Colour <input type="radio" name="bw/c" value="3" /><br /> Double Sided Colour <input type="radio" name="bw/c" value="4" /><br /> <select name="Ptype" value="<?for ($i = 0; $i < $rows; $i++){$data = mysql_fetch_object($result);"$data->Valeu"?>"> <option name='bw/c/pt' value=''><?echo "$data->Name";}?> </select> </div> if you need the rest of the coding let me kno. Thank You Link to comment https://forums.phpfreaks.com/topic/186504-not-sure-where-im-going-wrong-s/ Share on other sites More sharing options...
Buddski Posted December 28, 2009 Share Posted December 28, 2009 This makes no sense <select name="Ptype" value="<?for ($i = 0; $i < $rows; $i++){$data = mysql_fetch_object($result);"$data->Valeu"?>"> <option name='bw/c/pt' value=''><?echo "$data->Name";}?> </select> the best way to do it is.. <?php echo '<select name="Ptype">'; while($data = mysql_fetch_assoc($result)) { echo '<option name='bw/c/pt' value="'.$data['value'].'">'.$data['name'].'</option>'."\n"; } echo '</select>'; ?> or something Link to comment https://forums.phpfreaks.com/topic/186504-not-sure-where-im-going-wrong-s/#findComment-984909 Share on other sites More sharing options...
Buddski Posted December 28, 2009 Share Posted December 28, 2009 <?php echo '<select name="Ptype">'; while($data = mysql_fetch_assoc($result)) { echo '<option value="'.$data['value'].'">'.$data['name'].'</option>'."\n"; } echo '</select>'; ?> Just revising what I posted earlier.. Link to comment https://forums.phpfreaks.com/topic/186504-not-sure-where-im-going-wrong-s/#findComment-984931 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.