mcurry Posted June 21, 2011 Share Posted June 21, 2011 Hi all,I run a website for an organisation that is an umbrella group for 150ish organisations.I have included contact details for each organisation on the member directory on our website, but I have not included email addresses to date. The reason for this is the age-old worry about spam. I wouldn't want our members to get junk mail because of me...So to this end I want to include a 'contact us' form. I'm quite happy to create this and include each member as a choice in the drop down list.BUT because there's 150ish members that makes a looooong drop down list. What I would like to do is have a listing like this:Member nameaddressemail usThe "email us" link would take you to the contact us form - *with the member auto-selected from the drop down list*. I don't know how to do this... do you?Any help welcome.Cheers,Mike Link to comment Share on other sites More sharing options...
thescientist Posted June 21, 2011 Share Posted June 21, 2011 you could make email us a link to your contact page, and pass it an argument via GET, i.e. www.youtsite.com/contact.php?member=memberName where memberName is literally the name of that member.part of the beginning of the contact.php would be to have a list of all your memberNames, and you write a loop to output the drop down list, and for iteration, you could check if the passed memberName matches the current memberName being iterated, and if it, add selected="selected" to that particular option tag.i.e. <?php//assuming you have an array of members already$dropdown = '';$memberName = $_GET['memberName'];for($i = 0, $l = count($members); $i < l; $i++){ $name = $members[$i]; $dropdown .= "<option value'" . $name . "'"; if($name == $memberName){ $dropdown .= "selected='selected'"; }; $dropdown .= "'>" . $name . "</option>\n";}; and then you can echo/print that right out anywhere on the page in between some <select> tags. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.