Second query not work...

 <form method="post">
    <select name="selected" onChange="MM_jumpMenu('parent',this,1)">
    <?php
    // echo all id in table to options dropdown menu**
      $sql='SELECT id FROM lekcia1';
        $result=mysql_query($sql) or die(mysql_error($db));
        $a = 0;
        while ($recording=mysql_fetch_array($result)){
          $a ++;
          echo '<option value="'.$recording['selected'].'"> '.$a.' </option>';
        };
      ?>
     </select>
   </form>

     <?php
    // query NOT WORK
    $sql1="SELECT * FROM lekcia1 WHERE id='".$_POST['selected']."'"; // Notice: Undefined index:selected
    $result1=mysql_query($sql1) or die(mysql_error($db));
    $recording1=mysql_fetch_array($result1);
  ?>


  <ul>
    <li><?php echo $recording['nazov_lekcie'];?></li>
    <li><?php echo $recording['cislo_ulohy'];?></li>
    <li><?php echo $recording['nazov_ulohy'];?></li>
  </ul>

Have you tried validating that there is a value posted?

 $_POST['selected']

what err are you getting that may give clude.

Undefined index: selected in C:\xampp\htdocs\projekt\rpj\index-test.php on line 43

which one is line 43?

Please post whole code here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.