Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts

    Is it possible to pass value to populate sub-records without SUBMIT

    <!-- *** NEED HELP PASSING VALUE id TO POPULATE SUBRECORDS *** -->
    <!-- *** SEE MY NOTES ON LINE #51 to #55 *** -->

    <?php
    session_start();
    ob_start();
    if($_SESSION[userdetails]->role != "Admin") {
    die("Access Denied!");
    }
    require_once("includes/connect.php");
    // Check if he has the right info.
    $sql = sprintf("SELECT * FROM members ORDER BY username ASC", $_SESSION[userdetails]->id);
    $query = mysql_query($sql);
    // You are now connected
    ?>
    <head>
    <html>

    <head>
    <title>Split ListBox Text To Text Boxes</title>
    <script type="text/javascript"> <!-- archaic format: language="javascript" -->
    function SplitText (info) {
    if (info == '') { return; }
    var tarr = info.split(",");
    document.getElementById('tBox1').value = tarr[0];
    document.getElementById('tBox2').value = tarr[1];
    document.getElementById('tBox3').value = tarr[2];
    document.getElementById('tBox4').value = tarr[3];
    }
    </script>
    </head>

    <body>
    <form name="convert">
    <p style="margin: 2px">
    <p><select name="Groups" style="width: 176; height: 19; border: 1px solid #C0C0C0 ; font-size: 11px; font-family:Arial" size="1" onChange="SplitText(this.value)">
    <option>===Select Group===</option>
    <?php
    $sql1 = mysql_query("SELECT * FROM qw_groups");
    while($r1=mysql_fetch_assoc($sql1)){
    $f1 = $r1[id];
    $f2 = $r1[GroupName];
    echo "<option value='$f1,$f2,,'>$f2</option>";
    }
    echo "</select>";
    ?>
    <p><select name="GroupItems" style="width: 176; height: 19; border: 1px solid #C0C0C0 ; font-size: 11px; font-family:Arial" size="1" onChange="SplitText(this.value)">
    <option>===Select Group Item===</option>
    <?php
    //**************** NOTES******************************
    // **** IS IT POSSIBLE TO PASS THE VALUE "$f1" FROM GROUPS TO GROUPITEMS ****
    // **** I WANT TO POPULATE THE SECOND DROPDOWN LIST WITH SUB-RECORDS WITHOUT SUBMIT /POST /REFRESH /OR RELOAD ****
    // WHERE id = $f1 ?? maybe some java code id = $val onChange ??

    $sql2 = mysql_query("SELECT * FROM qw_groupitems WHERE id = $f1");
    while($r2=mysql_fetch_assoc($sql2)){
    $f3 = $r2[Subid];
    $f4 = $r2[GroupItem];
    echo "<option value='$f1,$f2,$f3,$f4'>$f4</option>";
    }
    echo "</select>";
    ?>
    </p>

    <!-- Input selected data from listBox -->
    <p style="margin: 2px">
    <input type="text" name="textbox1" id="tBox1" value=""><br>
    <input type="text" name="textbox2" id="tBox2" value=""><br>
    <input type="text" name="textbox3" id="tBox3" value=""><br>
    <input type="text" name="textbox4" id="tBox4" value=""><br>
    </p>
    </form>
    </body>
    </html>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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