Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors',0);
- session_start();
- include_once "../config.php";
- include_once "functions.php";
- include "../includes/db.php";
- print printHTMLHead();
- if ($_GET['mode'] == 'edit' || $_GET['mode'] == 'del') {
- $sql = "select * from dogbreeds where dogbreed = '" . $_GET['dogbreed'] . "'";
- $result = mysqli_query($_SESSION['dblink'],$sql);
- $record = mysqli_fetch_assoc($result);
- $dogbreed = $record['dogbreed'];
- $description = $record['description'];
- $country_code = $record['country_code'];
- $price = $record['price'];
- $discount_rate = $record['discount_rate'];
- }
- switch ($_GET['mode']) {
- case 'edit':
- $script = 'edit_dogbreed.php';
- break;
- case 'del':
- $script = 'del_dogbreed.php';
- break;
- case 'add':
- $script = 'add_dogbreed.php';
- break;
- }
- ?>
- <form method='post' action='<?php echo $script;?>'>
- <table class='dataform'>
- <tr>
- <td>Dog Breed:</td>
- <td><input type='text' name='dogbreed' value='<?php echo $dogbreed;?>'></td>
- </tr>
- <tr>
- <td>Description:</td>
- <td><input type='text' name='description' value='<?php echo $description;?>'></td>
- </tr>
- <tr>
- <td>Country:</td>
- <td>
- <select name='country_code'>
- <option value=''>[Select Country]</option>
- <?php
- $country_sql = "SELECT * FROM countries";
- $result = mysqli_query($_SESSION['dblink'],$country_sql);
- while ($record = mysqli_fetch_assoc($result)) {
- if ($record['country_code'] == $country_code) {
- $selected = " selected ";
- } else {
- $selected = null;
- }
- ?><option value='<?php echo $record['country_code'];?>' <?php echo $selected;?>><?php echo $record['country'];?></option>
- <?php
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Price:</td>
- <td><input type='text' name='price' value='<?php echo $price;?>'></td>
- </tr>
- <tr>
- <td>Discount Rate:</td>
- <td><input type='text' name='discount_rate' value='<?php echo $discount_rate;?>'></td>
- </tr>
- <tr>
- <td colspan='2'><input type='submit' value='Submit'></td>
- </tr>
- </table>
- </form>
- <?php
- print printFooter();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement