Wednesday, March 30, 2016

show info . php 1

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
           
        //step 1 = connect to the server
        $con = mysql_connect("localhost:3306" ,"root", "");
        
        //step 2 = select the datebase
        mysql_select_db("dvdclub", $con);
        
        //step 3 = execute the query
        $result = mysql_query("select id, FirstName from customers");

        ?>
        
        <form action="showinfo2.php" method="get">
            <select name="cust">
                <?php
                while ($row = mysql_fetch_array($result))
                {
                    ?>
                <option value="<?php echo $row["id"]?>">
                    <?php echo $row["FirstName"] ?>  Click me</option>
                <?php
                }
                ?>
            </select>
            <input type="submit" value="Show Customers Info"/>
        </form>
        
        
        
        <?php
        //step 4 = close the connection
        mysql_close($con);
        ?>
    </body>
</html>

No comments

Post a Comment

follow me

All Rights Reserved by personal © 2015 - 2016
Powered By Blogger, Designed by Mohammed ARG