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
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
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
Share on other sites

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  ";
Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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