Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to get all the data from a table particular column and display into a html table column as (select option). But nothing is showing. what did i do wrong?

What I have tried:

<form action="Report_customerHistory.php" method="POST">
<table align="center" border="0" align="center" style="width:40%">
    <tr>
        <th>
           
        </th>
        <th>
            
        </th>
        <th>
            
        </th>
    </tr>
    <tr>
        <td>
            <select name="VehicleNo">
                <option selected="" value="Default">(Please select.)</option>
                <?php
                include_once('db.php');
                
                $result=mysqli_query($con,"SELECT * FROM vehicle_customer");
                while($rawR1 = mysqli_fetch_array($result))
                {
                    $rawsData1=$rawR1['veh_reg_no']; 
                   
                ?>
                 <option value="<?php echo $rawsData1; ?>"><?php echo $rawsData1;?></option>
                <?php
                }
                ?>
            </select>
        </td>
        <td>
            
        </td>
        <td>
            
        </td>
    </tr>
</table>
Posted
Updated 6-Nov-17 0:43am
v2
Comments
Peter Leow 5-Nov-17 1:36am    
Any warning or error messages?
Suvendu Shekhar Giri 6-Nov-17 5:56am    
Paste db.php code here and yes please provide what error or warning message you are getting, if any.
Member 13049972 6-Nov-17 22:02pm    
i have resolved it, it was my web browser doing some messy things around , thanks for your comments guys

1 solution

Your PHP is an absolute mess - the loop code block, for example, is broken to throw in some HTML, php, more html, and then terminating the code block. It's just not done that way.

A php loop must all be in one continious php code block. You need to do a lot of study of php well before the concept of connecting to a database and retrieving data.

Try: PHP 5 Tutorial[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900