#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Herisau, Switzerland
    Posts
    1
    Rep Power
    0
    Hello,
    we are trying to transfer the $Landselection (from a <select> Tag) into the following <HREF> site. This site should be as body into frames.

    The mainproblem is: in the <HREF> line we never get the $LandSel from the <select>-tag

    what should we do? Thanks for your help!

    $query = "SELECT Land FROM countrylist GROUP BY Land ASC";
    $result = mysql_db_query("database", $query);
    $err = mysql_errno();
    $msg = mysql_error();

    if ($result) {
    echo ("<p><select name=LandSelection onChange="SelectLand()">");
    $rowcount=0;
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $Land = mysql_result($result, $rowcount,0);
    echo ("<option>");
    echo ("$Land");
    echo ("</option> ");
    $rowcount=$rowcount+1;
    };
    echo ("</select>");
    $LandSel = urlencode($LandSelection);
    echo ("<p><a HREF="body_updates.php?LandSel=$LandSel " TARGET="body">");
    echo ("search</a></p>");
    } else {
    echo "<P>no connection ...! $err - $msg </P>";
    };
    ?>


  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    London/UK
    Posts
    91
    Rep Power
    15
    give your <option> a value

    i.e.
    echo ("<option>");
    echo ("$Land");
    echo ("</option> ");

    into

    echo "n<option value="" . $Land . "">" . $Land . "</option>";

    ------------------
    http://back-end.org
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Hubert, NC, USA
    Posts
    5
    Rep Power
    0
    I believe you will need to wrap your selection in a <form> tag with a method of "GET" and your href target as the action. This will cause the user's browser to format the form variables you want into the URL and pass it to your target page.

    In you example, the HTML is formatted on the server BEFORE the client sees it and before the client can make a selection. Therefore, the client's selection cannot be formatted into the URL for your anchor tag.

    Something like the following should work;
    <form method="get" action="targetpage.php3">
    <select name="LandChoice">
    <? while ( there_are_more_options ) { ?>
    <option><? echo($Land);?></option>
    <? } /* end while */ ?>
    </select>
    <!-- button for sumitting form -->
    <input type="submit" name="Go" value="Go">
    </form>

    I hope this helps!

Similar Threads

  1. pass php value of a varible to javascript variable
    By fluke_tony in forum JavaScript Development
    Replies: 1
    Last Post: February 13th, 2004, 04:34 AM
  2. php variable issue
    By durilai in forum PHP Development
    Replies: 1
    Last Post: February 9th, 2004, 10:47 PM
  3. Get a Javascript variable into PHP, again
    By fchausson in forum JavaScript Development
    Replies: 2
    Last Post: February 5th, 2004, 10:55 AM
  4. .htaccess redirection with PHP variable
    By Avantasia in forum PHP Development
    Replies: 4
    Last Post: January 29th, 2004, 04:21 PM
  5. Pass Perl variable through PHP to browser?
    By dvd in forum Perl Programming
    Replies: 6
    Last Post: January 18th, 2004, 02:37 PM

IMN logo majestic logo threadwatch logo seochat tools logo