Hi everyone,
I could do with a little help with something i am trying to do. I have a page where users can read messages, it has a reply button on it that links to another page where they can reply to the message.
On the page where they can reply to a message is a combo box (drop down list or what ever the right name is) which holds the users they allowed to message. It gets the users names from a table in a database with an sql query.
My problem is that when a user clicks reply and it jumps to the page where they can type there reply with the combo box with the list of users. They have to manualy select the correct user to reply to.
What i want to do is for the combop box to automaticaly select the user that the message was from to reply to.
Now what ive come up with so far is to send over the person who the message is to be replyed to in a var then match it up with one that is in the combo box. It might be easier to see the code below.
Ok, so i send the user ID over in the URL
e.g.
<a href =/sendmessage.php?from=".$from.">Reply</a>
Then i get the users ID from that YRL in the next page
$from = $_GET['from'];
This is where im stuck i dont no how to slelect the user by their ID here within the combo box????? Ive seen in other example that you can use selected but have tried to use that but not had any luck. Any help would be great !
<p><label for ="to"><strong>To:</strong></label>
<SELECT NAME='to' width='300' id ='to' >
<?php
$query = "SELECT* FROM users ";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result))
{
echo "<OPTION value='$line['ID']'>$line['name']</OPTION>";
}?>
</SELECT></p>