3 dependant dropdown

Codes here !

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 4
Joined: Sat Sep 08, 2012 8:54 pm

3 dependant dropdown

Postby sachinkr » Sun Sep 16, 2012 10:31 pm

I am currently working with a Dependable dropdown menu that functions with the help of jQuery and PHP. The values are being pulled of MySQL database. Is there away to php echo the selected value of a dependable drop down menu?

Code: Select all

<script type="text/javascript">
function lnth_fwd()
var lnth=document.getElementById('lnthdet').value;

function wdth_fwd()
var lnthkk=document.getElementById('lnth2').value;

var wdth=document.getElementById('wdth').value;
function thkn_fwd()
var lnth4=document.getElementById('lnth4').value;
var wdth4=document.getElementById('wdth4').value;
var thkn=document.getElementById('thkn').value;

$con = mysql_connect("localhost","root","");
if (!$con)
  die('Could not connect: ' . mysql_error());
mysql_select_db("store", $con);
$filter_length = mysql_query("select  distinct(length) from vibrating_feeder_details ");
while($row = mysql_fetch_array($filter_length))
       $lnth_det[] = $row['length'];

echo '<select name="lnthdet" id="lnthdet" onchange="return lnth_fwd();">
<option >select</option>';
 for($ln=0 ; $ln < sizeof($lnth_det) ; $ln++){
echo '<option value='.$lnth_det[$ln].' >'.$lnth_det[$ln].'</option> '; }
echo '</select>';

    $lnth2 = $_REQUEST[lnth];
    //$qry2 = "select distinct width from  vibrating_feeder_details where length = '$lnth2'";
    $filter_thick2=mysql_query("select distinct width from  vibrating_feeder_details where length = '$lnth2' ");
    while($rowk2 = mysql_fetch_array($filter_thick2))
          $width_thk3[] = $rowk2['width'];
    echo '<input type="hidden" name="lnth2" id="lnth2" value="'.$lnth2.'">';
    echo '<select name="wdth" id="wdth" onchange="return wdth_fwd();">
    <option >select</option>';
     for($thk3=0 ; $thk3 < sizeof($width_thk3) ; $thk3++){
    echo '<option value='.$width_thk3[$thk3].'>'.$width_thk3[$thk3].'</option> '; }
    echo '</select>';
    $lnth4 = $_REQUEST[lnth];
    $wdth4 = $_REQUEST[wdth];
    $qry2 = "select distinct width from  vibrating_feeder_details where length = '$lnth2'";
    $filter_thick4=mysql_query("select distinct thickness from  vibrating_feeder_details where length = '$lnth4' AND width = '$wdth4' ");
    while($rowk4 = mysql_fetch_array($filter_thick4))
          $thk_thk4[] = $rowk4['thickness'];
    echo '<input type="hidden" name="lnth4" id="lnth4" value="'.$lnth4.'">';
    echo '<input type="hidden" name="wdth4" id="wdth4" value="'.$wdth4.'">';
    echo '<select name="thkn" id="thkn" onchange="return thkn_fwd();">
    <option >select</option>';
     for($thk5=0 ; $thk5 < sizeof($thk_thk4) ; $thk5++){
    echo '<option value='.$thk_thk4[$thk5].'>'.$thk_thk4[$thk5].'</option> '; }
    echo '</select>';

    $lnth6 = $_REQUEST[lnth];
    $wdth6 = $_REQUEST[wdth];
    $thkn6 = $_REQUEST[thkn];
  $sql = "select * vibrating_feeder_details where thickness=$_POST[select]";
//$res = mysql_query($sql);
//$row = mysql_fetch_array($res);
<table width="90%" border="5">
    <td><?php echo $row['length'];?></td>
   <td><?php echo $row['width'];?></td>
   <td><?php echo $row['thickness'];?></td>
   <td><?php echo $row['Backsheetthickness'];?></td>
   <td><?php echo $row['SpringRibsthickness'];?></td>
   <td><?php echo $row['Sidepanelsthickness'];?></td>
   <td><?php echo $row['BaseRibthickness'];?></td>
   <td><?php echo $row['AllotherRibsthickness'];?></td>
   <td><?php echo $row['SPthickness'];?></td>
   <td><?php echo $row['SpringAnglesSathickness'];?></td>
   <td><?php echo $row['TroughAngle'];?></td>
   <td><?php echo $row['Troughheight'];?></td>
   <td><?php echo $row['B1'];?></td>
   <td><?php echo $row['Lw'];?></td>
   <td><?php echo $row['Hbr'];?></td>
   <td><?php echo $row['BxW'];?></td>
   <td><?php echo $row['Fw'];?></td>
   <td><?php echo $row['BxL'];?></td>
   <td><?php echo $row['L'];?></td>
   <td><?php echo $row['C'];?></td>
   <td><?php echo $row['Nos'];?></td>
   <td><?php echo $row['P'];?></td>
   <td><?php echo $row['Q'];?></td>
   <td><?php echo $row['R'];?></td>
Regards. sachin

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest