SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    May 2004
    Location
    Belgrade
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Why this code wont work in Firefox and Safari???

    Hi,
    I made this form with two drop down menues... and when you select something in one pare reload and other dropdown get necesery variable to select from database and create options and values. This work in Explorer, but in Firefox and Safari it showing this error:

    The requested URL /blic_auto/automobili/undefined was not found on this server.

    And code look like this
    ............
    Code PHP:
    <script type="text/JavaScript">
    <!--
     
     
    function jmp(form, elt) {
    // The first parameter is a reference to the form.
    if (form != null) {
    with (form.elements[elt]) {
    if (0 <= selectedIndex)
    location = options.value;
    }
    }
    }
    //-->
    </script>
    <link href="../css/style1/style2.css" rel="stylesheet" type="text/css" />
    </head>
     
    <body>
    <form action="rezultati.php" method="GET" name="form1" target="_parent" class="forma" id="form1">
    <?php
    if (IsSet($_GET['ime'])){
    	$ime = $_GET['ime'];
    ?>
       proizvodjac:
       <select name="select1" class="input_polja" id="select1" onchange="jmp(this.form,0)">
         <option value="<?php $_SERVER['PHP_SELF'];?>?ime=">bilo koji proizvodjac </option>
         <?php
     do {
     $idproizvodjaca=$row_p1['ID'];
    if ($idproizvodjaca == $ime) {
    ?>
         <option value="<?php $_SERVER['PHP_SELF'];?>?ime=<?php echo $row_p1['ID']?>" selected="selected"><?php echo $row_p1['NAZIV']?></option>
    <?php
      }else{
      ?>
      <option value="<?php $_SERVER['PHP_SELF'];?>?ime=<?php echo $row_p1['ID']?>"><?php echo $row_p1['NAZIV']?></option>
    <?php
    }
    }while ($row_p1 = mysql_fetch_array($p1));
    ?>
      </select>
       <br />
       <br />
       <input name="proizvodilac" type="hidden" id="proizvodilac" value="<?php echo $ime ?>" />
      <label>model:</label>
      <label>
    <select name="model" class="input_polja" id="model">
    <option value="" selected="selected">bilo koji model</option>
      <?php
      //selektovanje modela po Id-u proizvodjaca
    mysql_select_db($database_blic_auto, $blic_auto);
    $query_model1 = "SELECT * FROM auto_model WHERE auto_model.ID_AUTO='$ime' ORDER BY auto_model.NAZIV";
    $model1 = mysql_query($query_model1, $blic_auto) or die(mysql_error());
    $row_model1 = mysql_fetch_assoc($model1);
    $totalRows_model1 = mysql_num_rows($model1);
     
    do {
    ?>
      <option value="<?php echo $row_model1['ID']?>"><?php echo $row_model1['NAZIV']?></option>
      <?php
    } while ($row_model1 = mysql_fetch_assoc($model1));
      $rows = mysql_num_rows($model1);
      if($rows > 0) {
          mysql_data_seek($model1, 0);
    	  $row_model1 = mysql_fetch_assoc($model1);
      }
     
    } else {
    ?>
    </select>
    </label>
    <!-- ovde pocinje forma bez opcije za biranje modela -->
     <label>
      proizvodjac
      <select name="select" class="input_polja" id="select" onchange="jmp(this.form,0)">
        <option value="<?php $_SERVER['PHP_SELF'];?>?ime=" selected="selected">bilo koji proizvodjac </option>
        <?php
    do {  
    ?>
        <option value="<?php $_SERVER['PHP_SELF'];?>?ime=<?php echo $row_p1['ID']?>"><?php echo $row_p1['NAZIV']?></option>
        <?php
    } while ($row_p1 = mysql_fetch_assoc($p1));
      $rows = mysql_num_rows($p1);
      if($rows > 0) {
          mysql_data_seek($p1, 0);
    	  $row_p1 = mysql_fetch_assoc($p1);
      }
    ?>
      </select>
      <br />
      <br />
    </label>
      <label>
      model:
      <select name="model" class="input_polja" id="model">
      </select>
      </label>
    <!-- ovde se zavrsava forma bey opcije biranja modela -->
    <?php
    }
    ?>
      <label></label>
      <table>
    etc...................................

    Someone got idea?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    JavaScript problem, not PHP, it appears.

  3. #3
    SitePoint Member
    Join Date
    May 2004
    Location
    Belgrade
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have an idea what to do with java?

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    I think it's a conflict between your javascript and your php...
    in the options you are giving it the value:
    PHP Code:
    <option value="<?php $_SERVER['PHP_SELF'];?>?ime=" selected="selected">bilo koji proizvodjac </option>
    and asking the javascript to go to the url page.php?ime= with the location = options.value;

    does the error happen on the first select or the second?
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Member
    Join Date
    May 2004
    Location
    Belgrade
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Error hapens on secon section where "ime" is defined... I change java script function "jmp" and its works... I put simple function like in dreamweaver for jump menu.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •