NoDoze Posted January 18, 2007 Share Posted January 18, 2007 I have tis code already[code]<select name="clientcode" class="txtbox"> <option value="1" selected></option><?php$result = mysql_query("SELECT * FROM clienttype") or die(mysql_error());;while($row = mysql_fetch_array($result)){ echo '<option value="' . $row['client'] .'"> ' . $row['client'] ."</option>\n ";}?></select>[/code]As you see it pulls the list options from a table.My questions is how do I modify this to add another table...So that it lists the two tables next to each other? Does that make sense?See...each client has a code. The clients are in one table and the codes in another table. But on the form, the options list needs to show the client with their code...so I need the two tables listed next to each other so that the clients line up with their code, side by side.I can't figure it out...Thanks! Quote Link to comment Share on other sites More sharing options...
NoDoze Posted January 19, 2007 Author Share Posted January 19, 2007 ok....[code]<select name="clientcode" class="txtbox"> <option value="1" selected></option><?php$result = mysql_query("SELECT * FROM clienttype") or die(mysql_error());;while($row = mysql_fetch_array($result)){ echo '<option value="' . $row['client'] .'"> ' . $row['client'] ."</option>\n "; echo '<option value="' . $row['code'] .'"> ' . $row['code'] ."</option>\n ";}?></select>[/code]This gets the lists like this:clientcodeclientcodeBUT I need it like this:client codeclient codeAny help? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted January 19, 2007 Share Posted January 19, 2007 [code]<select name="clientcode" class="txtbox"> <option value="1" selected></option><?php$result = mysql_query("SELECT * FROM clienttype") or die(mysql_error());;while($row = mysql_fetch_array($result)){ echo '<option value="' . $row['client'] .'"> ' . $row['client'] $row['code']."</option>\n ";}?></select>[/code]Not sure if that will work or not...I don't see why it wouldn't... Quote Link to comment Share on other sites More sharing options...
NoDoze Posted January 19, 2007 Author Share Posted January 19, 2007 It's not working...I get a blank page, suspecting it doesn't like the code....Hmmm....Anyone with any other ideas? Looks fairly simple, but it's got us stumped...? Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 19, 2007 Share Posted January 19, 2007 There is a syntax error here: echo '<option value="' . $row['client'] .'"> ' . $row['client'] $row['code']."</option>\n ";change it to echo '<option value="'. $row['client'] .'"> ' . $row['client'].$row['code']."</option>\n "; Quote Link to comment Share on other sites More sharing options...
NoDoze Posted January 19, 2007 Author Share Posted January 19, 2007 SWEET! AWESOME! It worked! :)At first it was:clientcodeclientcodeNow it's:clientcodeclientcodeJust need the spaces...?Hmmm...I'm glad that hard part is over with! ;) Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 19, 2007 Share Posted January 19, 2007 echo '<option value="' . $row['client'] .'"> ' . $row['client'].'<br />'.$row['code']."</option>\n "; Quote Link to comment Share on other sites More sharing options...
NoDoze Posted January 19, 2007 Author Share Posted January 19, 2007 AWESOME! THANK YOU!Where have you been! Quickest and best response ever!Thank you! Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 19, 2007 Share Posted January 19, 2007 Yeah there was supposed to be a br in there.You might want to brush up on the BASICS of HTML. Quote Link to comment Share on other sites More sharing options...
NoDoze Posted January 19, 2007 Author Share Posted January 19, 2007 A <br> ...?In this code?echo '<option value="' . $row['client'] .'"> ' . $row['client'].''.$row['code']."</option>\n ";But that's in php...not html......so you're saying it'd be like '<br>' or "<br>"???Well, it works now is mainly what I was concerned about...You're earlier suggestion was suffecient.But didn't think a <br> would suffice too...Dunno how that'd play in... Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted January 20, 2007 Share Posted January 20, 2007 It is a mix of PHP and HTML toghether. The <option value=""> is HTML that is coded with PHP inside that string. Understand? ^^ Quote Link to comment Share on other sites More sharing options...
NoDoze Posted January 22, 2007 Author Share Posted January 22, 2007 Yup, I already know that....just don't understand how brushing up on my html would help with a php question...I guess she's suggesting a "<br>" would work also...??? Quote Link to comment 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.