Results 1 to 3 of 3
  1. #1
    porta325 is offline Member
    Join Date
    Nov 2007
    Posts
    2
    Rep Power
    0

    Default reload form problem

    Hey guys, i'm completely stranger to java and i found a piece of code that i needed to use. But the problem is that it won't work, i get an "object required" error. Can anyone please help me? Thanks alot!!

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>

    </head>
    <SCRIPT language=JavaScript>
    function reload(form){
    var val=form.judet.options[form.judet.options.selectedIndex].value;
    self.location='test.php?judet=' + val ;
    }
    </script>

    <?php
    mysql_connect("localhost", "root", "") or die(mysql_error());
    mysql_select_db("accommod") or die(mysql_error());
    $result = mysql_query ("SELECT * FROM jud ORDER BY judet ");
    $judet = $_GET['judet'];
    $result1 = mysql_query ("select orase.id_oras, orase.oras, jud.judet from orase, jud where id_oras = judet");

    $i = 1; //set $i to 1 outside the loop
    ?>
    <body>

    <?php

    echo "<select name=\"judet\" onchange=\"reload(this.form)\">";

    echo "<option>";
    $i=1;
    while ($row=mysql_fetch_assoc($result)) {
    $judet=$row['judet'];
    echo "<a href=\"index.php?judet=$judet\">$judet</a>"; //display the records in a <td>
    $i = $i + 1;
    if ($i == 2){
    echo "</option><option>";

    $i=1;
    }
    }

    ?>
    </select>
    <?php
    echo "<select name=\"oras\">";
    echo "<option>";
    $i=1;
    while ($row=mysql_fetch_assoc($result1)) {
    $oras=$row['oras'];
    echo "$oras"; //display the records in a <td>
    $i = $i + 1;
    if ($i == 2){
    echo "</option><option>";

    $i=1;
    }
    }

    ?>

    </select>
    <input type="submit" value="baga">
    </form>
    </body>
    </html>

  2. #2
    Turtle is offline Member
    Join Date
    Nov 2007
    Location
    New Zealand
    Posts
    36
    Rep Power
    0

    Default

    Hi porta325,

    This is a java forum, not a java-script forum.

    Java is a completely different language to java-script.

    You are more likely to receive the help you need at java-script forum.

    Good luck

  3. #3
    porta325 is offline Member
    Join Date
    Nov 2007
    Posts
    2
    Rep Power
    0

Similar Threads

  1. problem with parameters of a form
    By ravi503 in forum New To Java
    Replies: 0
    Last Post: 03-13-2008, 07:59 AM
  2. I am new tothis form
    By Srinivas in forum Introductions
    Replies: 1
    Last Post: 02-06-2008, 07:37 AM
  3. Form Notes
    By creel in forum Java Applets
    Replies: 0
    Last Post: 02-02-2008, 02:25 AM
  4. how to reload a jsp page
    By Heather in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-15-2007, 12:49 AM
  5. Form Help Pls
    By CoOlbOyCoOl in forum NetBeans
    Replies: 4
    Last Post: 05-27-2007, 09:31 AM

Posting Permissions

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