I'm working on a Private Messaging script in which I want to add a drop down for one of the fields.
The drop down is auto-populated with user names from my DB.
This script functions well without the drop down, but when I add it... it returns the error that I have in the script for misspelled names.
The name has to match the name in the database exactly (case sensitive) or you get the error, that's why I want the drop down.... easier for the user, they don't have to worry about typos.
I thought maybe it was a 'blank space' problem, so I tried using trim in a couple of different locations in the script, without any luck.
The php echo receiver is so the message gets to the right user in the DB.
The auto-population works great... It looks right when displayed on the page, I just can't get it to work in conjuntion with the form.
If someone has some experience in this, I'd appreciate some pointers.
Thanks.
Here's the form script with the drop down added:
Code:<?php $sql="SELECT member_id, login FROM members ORDER BY login ASC"; $result=mysql_query($sql); $options=""; while ($row=mysql_fetch_array($result)) { $member_id=$row["member_id"]; $login=$row["login"]; $options.="<OPTION VALUE=\"$member_id\">".$login; } ?> <form name="send" method="post" action="compose2test3.php"> <TABLE BGCOLOR="#ffffff"> <table width="80%"> <tr> <td width="150px" align="left" valign="top"><p>Username*</p></td> <td width="" align="left" valign="top"><select input name="login" type="text" id="login" value="<?php echo "$reciever"; ?>"><OPTION VALUE=0>Users<?=$options?></SELECT></td> </tr> <tr> <td width="150px" align="left" valign="top"><p>Subject*</p></td> <td width="" align="left" valign="top"><input name="subject" type="text" id="subject" value="<?php echo "$subject"; ?>"></td> </tr> <tr> <td width="150px" align="left" valign="top"><p>Send (US Mountain S Time)</p></td> <td width="" align="left" valign="top"><input name="senton" type="hidden" value="NOW()<?php echo "$senton"; ?>"></td> </tr> <tr> <td width="150px" align="left" valign="top"><p>Message Body*</p></td> <td width="" align="left" valign="top"><textarea name="message" type="text" id="message" value="" cols="50" rows="10"></textarea></td> </tr> <tr> <td></td> <td><input type="submit" name="Submit" value="Send Message"></td> </tr> </table> </center> </form>



Reply With Quote
Bookmarks