Jump to content

Creating option lists in cms for php shop


slaterino

Recommended Posts

Hi,

I am designing a shop in php. At the moment the information I get for any product is name, description, price, postage and image. However, I want to include variables such as size, colour and detail. My idea to include these was to have a seperate table for each variable (i.e. a size table, colour table, etc.) then when reproducing in the actual shop I can program to list all colours in a table that match the product id. However, I am unsure how to create a CMS for this.

 

Does anyone have any ideas how to do this? My idea would be to have a drop-down list of variables. There would then be a button to add these to the item. The page could then refresh and list which variables had been added below. There would also need to be a button to delete these variables also. I have not created php pages with more than one source table on. If I was to do it this way how would I include the code to do this process?

 

I am very grateful for any help! I hope this all makes sense! I have includes my current cms form below.

 

Thanks

Russ

 

<?php
include("../lib/config.php");
error_reporting(0);
        if(isset($_POST['submit']))
	{
		  
$query = "INSERT INTO merch (path, prod_name, description, price, postage) ".
"VALUES ('$imagepath', '$prod_name', '$description', '$price', '$postage')";

mysql_query($query) or die('Error, query failed : ' . mysql_error());
            echo "Product Added: <img src='../../images/shop/".$imagepath."'>"; 

          }
        }
?>
<form action="<?php echo $_server['php-self'];  ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
<table>
<tr>
<td>Name:</td><td><input name="txtName" type="text" id="txtName" size="40" maxlength="50"></td></tr>
<tr>
<td>Description: </td><td><input name="txtDescription" type="text" id="txtDescription" size="40" maxlength="50"></td></tr>
<tr>
<td>Price: </td><td><input name="txtPrice" type="text" id="txtPrice" size="40" maxlength="10"></td></tr>
<tr>
<td>Postage: </td><td><input name="txtPostage" type="text" id="txtPostage" size="40" maxlength="10"></td></tr>
<tr>
<td>Image: </td><td><input name="new_image" id="new_image" size="30" type="file" class="fileUpload" /><br /></td></tr>
<tr>
</table>
<br />
        <div align="center">
          <input type="submit" name="submit" value="Add Product">
        </div>
</form>
<?php
echo "<br /><a href=\"index.php\"><-- Go Back</a>";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.