Jump to content

Form list options


NoDoze

Recommended Posts

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!
Link to comment
https://forums.phpfreaks.com/topic/34816-form-list-options/
Share on other sites

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:
client
code
client
code

BUT I need it like this:
client  code
client  code

Any help?
Link to comment
https://forums.phpfreaks.com/topic/34816-form-list-options/#findComment-164113
Share on other sites

[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...
Link to comment
https://forums.phpfreaks.com/topic/34816-form-list-options/#findComment-164133
Share on other sites

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...
Link to comment
https://forums.phpfreaks.com/topic/34816-form-list-options/#findComment-164741
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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