Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $DB_host = "localhost";
- $DB_user = "root";
- $DB_pass = "";
- $DB_name = "test_shop";
- $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf-8');
- try
- {
- $DB_con = new PDO("mysql:host={$DB_host};dbname={$DB_name}",$DB_user,$DB_pass);
- $DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $DB_con->exec('SET NAMES utf8');
- }
- catch(PDOException $e)
- {
- $e->getMessage();
- }
- ?>
- <style>
- .left{
- }
- .new{
- display: inline-block;
- }
- .add{
- display: inline-block;
- }
- .woname_cat{
- display: inline-block;
- }
- </style>
- <div class="left">
- <?php
- $stmt = $DB_con->query("SELECT * FROM `test_table`");
- while ($row = $stmt->fetch())
- {
- echo
- '
- <form method="POST" class="new">
- <input type="hidden" name="con" value="'.$row['number'].'"/>
- <input type="submit" name="selecteds" value="'.$row['name'].'"/>
- </form>
- ';
- }
- ?>
- </div>
- <div class="add">
- <?php
- if(isset($_POST['selecteds'])){
- $id = $_POST['con'];
- $stmt = $DB_con->query("SELECT * FROM `cat_woman` WHERE `number` ='$id' ");
- while ($row = $stmt->fetch())
- {
- echo '
- <form method="POST" class="woname_cat">
- <input type="hidden" name="cat_shop" value="'.$row['number'].'"/>
- <input type="submit" name="shopw" value="'.$row['shop'].'"/>
- </form>
- ';
- }
- }
- ?>
- </div>
- <div>
- <?php
- if(isset($_POST['shopw'])){
- $id = $_POST['cat_shop'];
- $stmt = $DB_con->query("SELECT * FROM `product` WHERE `id_cat` ='$id' ");
- while ($row = $stmt->fetch())
- {
- echo '
- <p>'.$row['name'].'</p>
- <p>'.$row['desc'].'</p>
- ';
- }
- }
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement