mr_fitz
05-05-2003, 07:20 PM
I have a form that includes a dropdown list of links that are to be populated from a mysql database.
The following code will produce:
http://www.google.ca/?member_link=http%3A%2F%2Fwww.google.ca
if www.google.ca (http://www.google.ca ) is in the mysql database for $member_link
<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 realize I have redundant code here, I know so very little about javascript and forms - I have been trying different variations for hours and cannot get anything to work.
The following code will produce:
http://www.google.ca/?member_link=http%3A%2F%2Fwww.google.ca
if www.google.ca (http://www.google.ca ) is in the mysql database for $member_link
<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 realize I have redundant code here, I know so very little about javascript and forms - I have been trying different variations for hours and cannot get anything to work.