...

View Full Version : Is it possible to pass value to populate sub-records without SUBMIT



DataTalk
11-30-2010, 02:30 AM
<!-- *** 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>

abduraooft
11-30-2010, 09:53 AM
Yes, take a look in to http://bonrouge.com/~chain_select_ajax



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum