print-copy-excel-doesnt-print-selected-option-value

print-copy-excel-doesnt-print-selected-option-value

softchannel47softchannel47 Posts: 1Questions: 0Answers: 0
edited April 23 in Free community support
<table id="example" class="myTable hover nowrap" style="width:100%">

                <thead>
                    <tr>
                        <th>Invoice No</th>
                        <th>Brand</th>
                        <th>Model</th>
                        <th>IMEI</th>
                        <th>Shop Name</th>
                        <th>Status</th>
                        <th>Entered By</th>
                        <th>Insert at</th>
                        <th>Customer Name</th>
                        <th>Options</th>
                    </tr>
                </thead>
                <tbody>
             
                        <tr id="">
                            <td><?php echo $fetchrepair['invoice_no']; ?></td>
                            <td><?php echo $fetchrepair['brand']; ?></td>
                            <td><?php echo $fetchrepair['makemodel']; ?></td>
                            <td><?php echo $fetchrepair['imei']; ?></td>
                            <td <?php echo ($_SESSION['user_type'] == 'admin') ? '' : 'hidden'; ?>><?php echo $fetchrepair['shop_name']; ?></td>
                            <td><?php echo '<select class="' . $getcolor . '" name="changestatus" onchange="saveinfo(' . $fetchrepair['id'] . ',this.value,\'repair_status\');" required style="width: 150px;">
                                <option value="" disabled selected>Choose</option>
                                <option value="0"' . ($fetchrepair['repair_status'] == '0' ? ' selected' : '') . '>In Progress</option>
                                <option value="1"' . ($fetchrepair['repair_status'] == '1' ? ' selected' : '') . '>Pending</option>
                                <option value="2"' . ($fetchrepair['repair_status'] == '2' ? ' selected' : '') . '>Fixed</option>
                                <option value="3"' . ($fetchrepair['repair_status'] == '3' ? ' selected' : '') . '>Not Fixed</option>
                                </select>
                                    '; ?>
                            </td>
                            <td><?php echo $fetchrepair['f_name'] . " " . $fetchrepair['l_name']; ?></td>
                            <td><?php echo date('d/m/Y H:i:s', strtotime($fetchrepair['crt_date'])); ?></td>
                            
                            <td><?php echo $fetchrepair['cus_name']; ?></td>
                            <td>
                                <a href="generateInvoice.php?invoiceno=<?php echo $fetchrepair['repairID']; ?>" title="Print Invoice" class="btn btn-warning text-white mb-2">
                                    <i class="fa-solid fa-print"></i>
                                </a>
                                <a href="update-mobile-repair?editrepair=<?php echo $fetchrepair['repairID']; ?>" class="btn btn-info text-white mb-2">
                                    <i class="fa-solid fa-pen-to-square"></i>
                                </a>
                                <button <?php echo ($_SESSION['user_type'] == 'Shop') ? 'hidden' : ''; ?> onclick="del(delrepair,<?php echo $fetchrepair['repairID']; ?>);" type="button" class="btn btn-danger mb-2">
                                    <i class="fa-solid fa-trash"></i>
                                </button>
                            </td>
                        </tr>
                    <?php
                    }
                    ?>
                </tbody>
                <tfoot>
                    <tr>
                        <th>Invoice No</th>
                        <th>Brand</th>
                        <th>Model</th>
                        <th>IMEI</th>
                        <th <?php echo ($_SESSION['user_type'] == 'admin') ? '' : 'hidden'; ?>>Shop Name</th>
                        <th>Customer Name</th>
                        <th>Entered By</th>
                        <th>Insert at</th>
                        <th>Status</th>
                        <th>Options</th>
                    </tr>
                </tfoot>
            </table>

The 6th column is for status (select) and when I print it I see all 4 status being printed instead of just the selected value,

Replies

  • allanallan Posts: 61,822Questions: 1Answers: 10,127 Site admin

    You need to use a formatting function to get the data from the node. There are a number of other threads on this topic in the forum if you search for them.

    Allan

Sign In or Register to comment.