Page 1 of 1

Need to display input and output in one page of php?

Posted: Tue Mar 10, 2015 5:14 am
by gramya
I have number of rows in a table fetched from database. I need to display output of each row beside dat table only. output data also fetching from database.

Example: If i click first row means i want detail information about that row next to that table.

Jqurey

Code: Select all

  <script type="text/javascript">
      $(function() {
      $('#showmenu').click(function() {
      $(".menu").slideToggle();
      });
      });
      </script>
Php code First Table(Displaying Data)

Code: Select all

$query = "select * from orders_list";
                        $result = mysql_query($query);

                        $num_rows = mysql_num_rows($result);
                        if($num_rows >= 1)
                            {
                            echo "<div id='showmenu' class='scroll'>";  
                        echo "<table id='table_struct' cellspacing='0' cellpadding='1' border='1' width='400'>
                             <tr class='tr_class' bgcolor='#0066CC'>
                             <td align='center' style='font-weight:bold'> Select </td>
                             <td align='center' style='font-weight:bold'> order_id </td>
                             <td align='center' style='font-weight:bold'> customer_name </td>
                             <td align='center' style='font-weight:bold'> no_of_pack </td>
                             <td align='center' style='font-weight:bold'> price </td>
                             <td align='center' style='font-weight:bold'> Weight </td>
                             <td align='center' style='font-weight:bold'> payment mode </td>
                        </tr>";

                            while($row = mysql_fetch_array($result))
                            {

                                    $order_id = $row['order_id'];
                                    echo "<tr>
                                    <td align='center'><input type='checkbox' class='case' name='case' value='1'></td>
                                    <td align='center'>".$row['order_id']."</td>
                                    <td align='center'>".$row['customer_name']."</td>
                                    <td align='center'>".$row['number_of_pack']."</td>
                                    <td align='center'>".$row['price']."</td>
                                    <td align='center'>".$row['weight']."</td>
                                    <td align='center'>".$row['payment']."</td>";
                            echo "</tr>";
                                    }
                                    echo "</table>";
                                    echo "</div>";
                                    }
code for output to display in same page:

Code: Select all

$_SESSION['order_id'] = $order_id;
                        echo $_SESSION['order_id'];
                        $query = "select * from orders_details where order_id=$order_id";
                        $result = mysql_query($query);

                        $num_rows = mysql_num_rows($result);
                        if($num_rows >= 1)
                            {
                            echo "<div class='menu' class='scroll'>";   
                        echo "<table id='table_struct' cellspacing='0' cellpadding='1' border='1' width='400'>
                             <tr class='tr_class' bgcolor='#0066CC'>
                             <td align='center' style='font-weight:bold'> Product </td>
                             <td align='center' style='font-weight:bold'> Quantity </td>
                             <td align='center' style='font-weight:bold'> Sku </td>
                             <td align='center' style='font-weight:bold'> Price </td>
                             <td align='center' style='font-weight:bold'> Total </td>

                        </tr>";

                            while($row = mysql_fetch_array($result))
                            {
                                    echo "<tr>
                                    <td align='center'><input type='checkbox' class='case' name='case' value='1'></td>
                                    <td align='center'>".$row['product']."</td>
                                    <td align='center'>".$row['quantity']."</td>
                                    <td align='center'>".$row['sku']."</td>
                                    <td align='center'>".$row['price']."</td>
                                    <td align='center'>".$row['total']."</td>";

                            echo "</tr>";
                                    }
                                    echo "</table>";
                                    echo "</div>";
                                    }