简体   繁体   English

我想在另一页上显示我的数据以单击按钮

[英]I want to display my data on another page to click a button

I am developing a app (Online Vehicle Sales Management System), I inserted data in DB and display all record on single page, but I have a problem, I want select a single record by clicking on button and show it another page ... 我正在开发一个应用程序(在线车辆销售管理系统),我在数据库中插入了数据并在单个页面上显示了所有记录,但是我有一个问题,我想通过单击按钮选择一个记录并显示在另一页面上...

Here is code: 这是代码:

<html>
    <head>
        <title>New Purchase</title>
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <script src="js/jquery.js"></script>
        <script src="js/bootstrap.min.js"></script>

        <?php
        session_start();

        if (isset($_POST['logout'])) {
            session_destroy();
            header("location: ovsms.php");
        }
        ?>
    </head>
    <body>
        <div class="jumbotron container-fluid" style="background-color:#4E4A49; 
             padding-top:10px; padding-bottom:0px;" >

            <a href="home.php" ><img src="ovsms.jpg" style="width:100px;"></a>

            <a href="ovsms.php" name="logout" style="margin-left:925px;  padding-
               right:10px; color:#F7008C;"><span class="glyphicon glyphicon-log-out">
                </span> LogOut</a>



            <h1 style="text-align:center; padding-bottom:20px; margin-top:10px;
                margin-bottom:20px; font-family:Lucida Calligraphy; color:#0566c3;">Online 
                Vehicle Sales Management System</h1>    
        </div>
        <div  style="color:black; "class="btn-group btn-group-justified" >
            <a href="home.php" class="btn btn-primary" ><span class="glyphicon 
                                                              glyphicon-home"></span> Home</a>
            <a href="about.php" class="btn btn-primary"><span class="glyphicon 
                                                              glyphicon-education"></span> About Us</a>
            <a  href="contact.php" class="btn btn-primary"> <span class="glyphicon 
                                                                  glyphicon-envelope"></span> Contact Us</a>
        </div>

        <div class="list-group" style="width:250px; margin-left:10px;">
            <h3 style="text-align:center; color:#0566c3;">Vehicles for...?</h3>
            <a style=" color:#0566c3;" href="newpurchase.php" class="list-group-item 
               ">new purchase</a>
            <a style=" color:#0566c3;" href="rent.php" class="list-group-item">Rent</a>

        </div>

        <div class="container-fluid">
            <form action="" method="post" >
                <div class="form-group">
                    <input type="text"  name="srno" placeholder="Select by Sr.No  ....">

                </div>
                <div class="form-group">
                    <button type="submit" name="view" class="btn btn-default" 
                            style="color:#F7008C; background-color:#0566c3;" ><span class="glyphicon 
                                                                            glyphicon-ok"></span> Select</button>
                </div>
            </form>
        </div>



        <div>
            <h1 class="container" style="color:#0566c3;"><span class="glyphicon glyphicon-bed"></span> Vehicles for New Purchase</h1>
            <?php
            include('DbConnect.php');

            $sql = mysql_query("select * from vehicledata");
            while ($row = mysql_fetch_array($sql)) {
                ?>

                <table class="table table-striped" class="container-fluid" style="margin:10;">
                    <form action="newpurchase.php" method="post" enctype="multipart/form-data" >
                        <tbody>
                            <tr>
                        <div class="form-group">

                            <thead><img width='250' src="<?php echo $row['image']; ?>" /></thead>
                        </div>
                        </tr>
                        <tr><div class="form-group" >

                            <td>Sr.No <b><?php echo $row['id']; ?></b>
                            </td><td></td>
                        </div></tr>
                        <tr><div class="form-group" >
                            <td>Company</td>
                            <td><b><?php echo $row['company']; ?></b>
                            </td>
                        </div></tr>

                        <tr><div class="form-group">
                            <td>Vehicle Name</td>
                            <td><b><?php echo $row['vehiclename']; ?></b></td>
                        </div>
                        </tr>
                        <tr><div class="form-group">
                            <td>Model</td>
                            <td><b><?php echo $row['model']; ?></b></td>
                        </div></tr>
                        <tr>
                        <div class="form-group">
                            <td>Fuel Type</td>
                            <td><b><?php echo $row['fuel']; ?></b></td>
                        </div></tr>
                        <tr>
                        <div class="form-group">
                            <td>Transmission Type</td>
                            <td><b><?php echo $row['tranmission']; ?></b></td></div></tr>
                        <tr><div class="form-group">
                            <td>Engine</td>
                            <td><b><?php echo $row['engine']; ?></b></td></div></tr>
                        <tr><div class="form-group">
                            <td>Driving Type</td>
                            <td><b><?php echo $row['drive']; ?></b></td></div></tr>
                        <tr><div class="form-group">
                            <td>Mileage (Km/L)</td>
                            <td><b><?php echo $row['mileage']; ?></b> </td></div></tr>
                        <tr><div class="form-group">
                            <td>Price in Rs =/</td>
                            <td><b><?php echo $row['price']; ?></b></td></div></tr>
                        <tr><div class="form-group">


                            <td><br>
                                <button type="submit" name="add" class="btn btn-default" style="color:#F7008C; background-color:#0566c3;" ><span class="glyphicon glyphicon-ok"></span> Select</button>

                            </td><td></td>
                        </div></tr>
                        </tbody>
                    </form>
                </table>
                <?php
            }
            ?>
        </div>
        <?php
        if (isset($_POST['view'])) {

            $srno = $_POST['srno'];
            $select = mysql_query("select * from vehicledata where id='$srno' ");
            if ($ro = mysql_fetch_array($select)) {
                ?>
                <div class="container-fluid"><h1>Your dream car is here...</h1>

                    <h2>You have to pay <?php echo $ro['price']; ?></h2></div>
                <div>   <table class="table table-striped" class="container-fluid" style="margin:10;">
                        <form action="newpurchase.php" method="post" enctype="multipart/form-data" >
                            <tbody>
                                <tr>
                            <div class="form-group">

                                <thead><img width='250' src="<?php echo $ro['image']; ?>" /></thead>
                            </div>
                            </tr>
                            <tr><div class="form-group" >

                                <td></b>
                                </td><td></td>
                            </div></tr>
                            <tr><div class="form-group" >

                                <td>Sr.No <b><?php echo $ro['id']; ?></b>
                                </td><td></td>
                            </div></tr>
                            <tr><div class="form-group" >
                                <td>Company</td>
                                <td><b><?php echo $ro['company']; ?></b>
                                </td>
                            </div></tr>

                            <tr><div class="form-group">
                                <td>Vehicle Name</td>
                                <td><b><?php echo $ro['vehiclename']; ?></b></td>
                            </div>
                            </tr>
                            <tr><div class="form-group">
                                <td>Model</td>
                                <td><b><?php echo $ro['model']; ?></b></td>
                            </div></tr>
                            <tr>
                            <div class="form-group">
                                <td>Fuel Type</td>
                                <td><b><?php echo $ro['fuel']; ?></b></td>
                            </div></tr>
                            <tr>
                            <div class="form-group">
                                <td>Transmission Type</td>
                                <td><b><?php echo $ro['tranmission']; ?></b></td></div></tr>
                            <tr><div class="form-group">
                                <td>Engine</td>
                                <td><b><?php echo $ro['engine']; ?></b></td></div></tr>
                            <tr><div class="form-group">
                                <td>Driving Type</td>
                                <td><b><?php echo $ro['drive']; ?></b></td></div></tr>
                            <tr><div class="form-group">
                                <td>Mileage (Km/L)</td>
                                <td><b><?php echo $ro['mileage']; ?></b> </td></div></tr>
                            <tr><div class="form-group">
                                <td>Price in Rs =/</td>
                                <td><b><?php echo $ro['price']; ?></b></td></div></tr>

                            </tbody>
                        </form>
                    </table></div>

                <?php
            }
        }
        ?>
    </body>
</html>

Try This: 尝试这个:

<td>
  <a href='other page url?view=<?php echo  $row['id']; ?>'>View</a>
</td>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我想在我的更新页面上显示选定的单选按钮 - I want to display the selected radio button on my update page 在另一页上显示选定的行,点击按钮 - Display selected row on another page, on button click 如果图像单击,我想重定向另一个页面 - if image click i want to redirect the another page 我想制作搜索页面,我想在“div”中显示我从数据库中搜索到的数据? - I want to make search page where I want to display my searched data from database in a "div"? 我想通过单击按钮来显示数据,但是我在1种表单上有2个以上的按钮。 - I want to display data using a click of a button, but i have more than 2 buttons on 1 form. 单击提交按钮后,我想重定向到我的管理页面 - I want to redirect to my admin page after I click the submit button 当我点击按钮时重新加载另一页 - Reload another page when I click on button 如何在单击按钮时将会话值保存为数组并显示在另一页上? - How can I save session values as array on button click and display on another page? 在我的图书馆管理系统中传递id和button单击参数后,我想以表格格式显示结果 - I want to display my results in table format after passing a parameter of id and button click in my library management system 单击按钮后,我想显示表格并打开新窗口 - After button click I want to display the table and open new window
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM