0

i have a table voucher in my database pdodb

in this voucher table i have a column named code ( text data ) and others infos_desc , info_sup , activite , lieu , operateur, tel_operateur and i have a select displaying all the codes

            <div class="select" style="width:200px;">
    <?php
    function load_desc()  
    {
        $connect = mysqli_connect("localhost", "root", "root", "pdodb"); 
        $output = ''; 
        $sql = "SELECT * FROM voucher ORDER BY code"; 
        $result = mysqli_query($connect, $sql); 
        while($row = mysqli_fetch_array($result))  
        {
            $output .= '<option value="'.$row["id"].'">'.$row["code"].'</option>'; // 
        }
            return $output;
    }


?>
<p> Select Code 
    <select name="code" id="code">
    <option value="">Select code </option>
    <?php echo load_desc(); ?>  
    </select></p>

</div>

so i wonder if i can, when i'm clicking submitting a 'code' data, echo all the other column who are bind to this code?

  • for this you will need javascript see https://stackoverflow.com/questions/7165395/call-php-function-from-javascript – nbk Jun 18 '21 at 15:24
  • so if i use an onclick function i can display all the column where this ''code'' is contained ? – Alexandre19xx Jun 18 '21 at 15:44
  • javascript runs on the cloent brwoser php run in the server. first you display the pulldoen and then get the data need again from the server – nbk Jun 18 '21 at 16:20

0 Answers0