Jump to content

Search the Community

Showing results for tags 'packages'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. i have a form for my admin to update the products and their deails on my site. but i have decided to add stock and supplier tables to the database. so i have a products table, stock and supplier. each have an id. in my admin form, id like the admin to submit once to multiple tables... php code that i need to improve <?php // Parse the form data and add inventory item to the system if (isset($_POST['product_name'])) { $product_name = $_POST['product_name']; $price = $_POST['price']; $category = $_POST['category']; $stock = $_POST['stock']; $details = $_POST['details']; $rating =$_POST['rating']; $letter = $_POST['letter']; $supplier = $_POST['supplier']; // See if that product name is an identical match to another product in the system $sql = mysqli_query($con, "SELECT id FROM products WHERE product_name='$product_name' LIMIT 1"); $productMatch = mysqli_num_rows($sql); // count the output amount //if product match is greater than 0 if ($productMatch > 0) { echo 'Sorry you tried to place a duplicate "Product Name" into the system, <a href="inventory_list.php">click here</a>'; exit(); } // Add this product into the database now by sql query $sql = mysqli_query($con, "INSERT INTO products (product_name, price, details, category, stock, letter, supplier, rating, date_added) VALUES('$product_name','$price','$details','$category', '$stock' ,'$letter',' $supplier' , '$rating' now())") or die (mysqli_error()); $pid = mysqli_insert_id($con); // Place image in the folder $newname = "$pid.jpg"; move_uploaded_file($_FILES['fileField']['tmp_name'], "../inventory_images/$newname"); //_FILES is a global var header("location: inventory_list.php"); //auto refresh, and it wont try to re add the item exit();//not necessary but its always safe to exit } ?> html form <form action="inventory_list.php" enctype="multipart/form-data" name="myForm" id="myForm" method="post"> <table width="95%" border="0" align="center" cellpadding="5" cellspacing="0" summary="this is where the admin will insert new items"> <caption><div id="title"><a id="add_new_item"></a>Add New Inventory Item</div> </caption> <tr > <th width="30%" scope="col" align="left">Product Image</th> <th width="70%"><label class="desc"> <input type="file" name="fileField" id="fileField" autofocus required /> </label></td> </tr> <tr > <th width="30%" scope="col" align="left">Product Name</th> <th width="70%" scope="col" align="left"> <label class="desc"> <input name="product_name" type="text" id="product_name" size="64" autofocus required /> </label></th> </tr> <tr> <th width="30%" scope="row" align="left">Letter</th> <td width="70%"> <label class="desc"> <input name="letter" type="text" id="letter" autofocus required /> </label></td> </tr> <tr> <th width="30%" scope="row" align="left">Product Price</th> <td width="70%"> <label class="desc"> <input name="price" type="text" id="price" autofocus required /> </label></td> </tr> <tr> <th width="30%" scope="row"align="left">Category</th> <td width="70%"><label class="desc"> <select name="category" id="category"> <option value="Fruits">Fruits</option> <option value="Vegetables">Vegetables</option> <option value="Indoor Plants">Indoor Plants</option> <option value="Outdoor Plants">Outdoor Plants</option> </select> </label></td> </tr> <tr> <th width="30%" scope="row" align="left">Suppliers</th> <td width="70%"> <label class="desc"> <select name="supplier" id="supplier"> <option value="Kenny's Organic Supplies">Kenny's Organic Supplies</option> <option value="Mom's Garden">Mom's Garden</option> <option value="Big Brother">Big Brother</option> </select> </label></td> </tr> <tr> <th width="30%" scope="row" align="left">Stock</th> <td width="70%"> <label class="desc"> <input name="stock" type="text" id="stock" autofocus required /> </label></td> </tr> <tr> <th width="30%" scope="row"align="left">Product Details</th> <td width="70%"><label class="desc"> <textarea name="details" id="details" cols="35" rows="5" autofocus required></textarea> </label></td> </tr> <tr> <th width="30%" scope="row" align="left">Rating</th> <td width="70%"><label class="desc"> <select name="rating" id="rating" > <option value="1">1 of 3 Stars</option> <option value="2">2 of 3 Stars</option> <option value="3">3 of 3 Stars</option> </select> </label></td> </tr> <tr> <th width="30%" scope="row"> </th> <td width="70%" align="right"><label class="desc"> <input type="submit" name="button" id="button" value="Add This Item Now" /> </label></td> </tr> <tr> <th width="30%" scope="row"> </th> <td width="70%"> </td> </tr> </table> </form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.