vomitbomb Posted May 15, 2008 Share Posted May 15, 2008 I can get the values from the database and put them in the text fields like so, but I can't put values back into the List menus (they all stay the same). //Update order echo'<form action="order.php" method="post"> <input type="hidden" name="fname" value="'.$row['fname'].'" /> <input type="hidden" name="lname" value="'.$row['lname'].'" /> <input type="hidden" name="lname" value="'.$row['tb24kg'].'" /> <input type="submit" value="Update-Order" /> </form>'; and then: <label>First <input type="text" name="fname" id="fname" value='<? echo "$fname" ?>' /> </label> <label>Surname <input type="text" name="lname" id="lname" value='<? echo "$lname" ?>' /> </label> <label>2-4kg <select name="tb24kg" size="1" id="tb24kg" value='<? echo "$tb24kg" ?>'> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </label> Anyone know why? Link to comment https://forums.phpfreaks.com/topic/105695-why-cant-i-put-database-values-back-into-a-list-menu/ Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 <select dosent have a value> does it? Link to comment https://forums.phpfreaks.com/topic/105695-why-cant-i-put-database-values-back-into-a-list-menu/#findComment-541524 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 Look at this properly please cheers.......... <select name="redarrow"> <?php $a=array("0","1","2","3","4","5"); for($i=0; $i<count($a); $i++){ echo" <option value='$a[$i]'>$a[$i]</option>"; } ?> </select> Link to comment https://forums.phpfreaks.com/topic/105695-why-cant-i-put-database-values-back-into-a-list-menu/#findComment-541525 Share on other sites More sharing options...
vomitbomb Posted May 15, 2008 Author Share Posted May 15, 2008 Yeah thats a better way to do the list menus, but it's not what I'm stuck with at the moment. Link to comment https://forums.phpfreaks.com/topic/105695-why-cant-i-put-database-values-back-into-a-list-menu/#findComment-541528 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 Can you tell me slowly what wrong please, as i dont get it sorry m8....... Link to comment https://forums.phpfreaks.com/topic/105695-why-cant-i-put-database-values-back-into-a-list-menu/#findComment-541530 Share on other sites More sharing options...
vomitbomb Posted May 15, 2008 Author Share Posted May 15, 2008 I worked out how I could put the values in the list menu like: <label>60-70 <select name="wt6070" id="wt6070"> <option value='<? echo "$wt6070" ?>' selected="selected"><? echo "$wt6070" ?></option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </label> Only problem is it seems to have to display a value at the bottom of the list menu. Say it has selected number 5 because the value of wt6070 is 5, 5 also appears below the 0 in the drop down menu. It's only an aesthetic thing but it's working which is cool. Link to comment https://forums.phpfreaks.com/topic/105695-why-cant-i-put-database-values-back-into-a-list-menu/#findComment-541539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.