PHP Classes

File: fwphp/01mater/shop/ch24_guitar_shop/admin/product/product_add_edit.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/01mater/shop/ch24_guitar_shop/admin/product/product_add_edit.php  >  Download  
File: fwphp/01mater/shop/ch24_guitar_shop/admin/product/product_add_edit.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 2 months ago
Size: 2,796 bytes


Class file image Download
<?php include '../../view/header.php'; ?>
include '../../view/sidebar_admin.php'; ?>
if (isset($product_id)) {
$heading_text = 'Edit Product';
    } else {
$heading_text = 'Add Product';
<h1>Product Manager - <?php echo $heading_text; ?></h1>
    <form action="index.php" method="post" id="add_product_form">
        <?php if (isset($product_id)) : ?>
<input type="hidden" name="action" value="update_product">
            <input type="hidden" name="product_id"
                   value="<?php echo $product_id; ?>">
        <?php else: ?>
<input type="hidden" name="action" value="add_product">
        <?php endif; ?>
<input type="hidden" name="category_id"
                   value="<?php echo $product['categoryID']; ?>">

        <select name="category_id">
        <?php foreach ($categories as $category) :
            if (
$category['categoryID'] == $product['categoryID']) {
$selected = 'selected';
            } else {
$selected = '';
<option value="<?php echo $category['categoryID']; ?>"<?php
echo $selected ?>>
                <?php echo htmlspecialchars($category['categoryName']); ?>
        <?php endforeach; ?>

        <input type="text" name="code"
               value="<?php echo htmlspecialchars($product['productCode']); ?>">

        <input type="text" name="name"
               value="<?php echo htmlspecialchars($product['productName']); ?>"

        <label>List Price:</label>
        <input type="text" name="price"
               value="<?php echo $product['listPrice']; ?>">

        <label>Discount Percent:</label>
        <input type="text" name="discount_percent"
               value="<?php echo $product['discountPercent']; ?>">

        <textarea name="description" rows="10"
                  cols="50"><?php echo $product['description']; ?></textarea>

        <input type="submit" value="Submit">
    <div id="formatting_directions">
        <h2>How to work with the description</h2>
            <li>Use two returns to start a new paragraph.</li>
            <li>Use an asterisk to mark items in a bulleted list.</li>
            <li>Use one return between items in a bulleted list.</li>
            <li>Use standard HMTL tags for bold and italics.</li>

<?php include '../../view/footer.php'; ?>

For more information send a message to info at phpclasses dot org.