html form, dropdown list, populate links with msql, php, js - links extra characters?
This seems to be a tough one, I have not found a solution elsewhere...so...here goes...
I have a form that includes a dropdown list of links that are to be populated from a mysql database. Sound simple enough?
The following code will produce:
http://www.google.ca/?member_link=ht...Fwww.google.ca
if www.google.ca is in the mysql database for $member_link
PHP Code:
<form name="member_links" target="_blank" method="GET" onsubmit="this.action=member_link[member_link.selectedIndex].value">
<select name="member_link">
<?php
$SQL = "SELECT * FROM member_links WHERE Name = '$membername' ORDER BY Link_Label ASC";
$result = mysql_query($SQL);
while ($myrow=mysql_fetch_array($result)) {
$member_link = $myrow["Link"];
$link_label = $myrow["Link_Label"];
$name = $myrow["Name"];
?>
<option value="<?php echo ('http://'. $member_link); ?>"><?php echo $link_label; ?></option>
<?php
}//end while
?>
</select>
<input type="submit" value="Go">
</form>
QUESTION IN A NUTSHELL:
How do I get rid of the:
?member_link=http%3A%2F%2Fwww.google.ca
part of each link in the drop down menu?
I have tried stripping the link from the "?" on with php, which I don't think works because of the way the javascript creates the link. There are more details here:
http://www.codingforums.com/showthre...threadid=19457
and
here:
http://forums.webdeveloper.com/showt...6249#post46249
More details here: