minxie6 Posted February 28, 2008 Share Posted February 28, 2008 hello all, can anyone help? I am making a online shop, this is my first website from code. I am trying to design a file upload script that stores all the product infomation, i have the form i can upload the file, i can connect to mysql database, however i can write only a few entrys 4 at max in one string or i get an error, this is the form, http://lingeriesites.co.uk/new/admin/admin.php as you can see there is lots of sizes, can i write all this as 1 row? or is the max 4 at a time? i want to be able to search by the sizes/categorys and words in discription, and display the image with all the data. there must be an easy way to do this as it seems like a common task, but i can only find help on staff scripts witch are a lot smaller and it dont help. plz help me Link to comment https://forums.phpfreaks.com/topic/93431-product-information-form-how-to-store-info/ Share on other sites More sharing options...
trq Posted February 28, 2008 Share Posted February 28, 2008 We need to see some relevent code. Link to comment https://forums.phpfreaks.com/topic/93431-product-information-form-how-to-store-info/#findComment-478671 Share on other sites More sharing options...
minxie6 Posted February 28, 2008 Author Share Posted February 28, 2008 This is the form; <? echo $_GET['cat']; ?> <html> <body bgcolor="black" text="white"> <body> <br /> <b>STOCK UPLOAD FORM, Please take care to get corect, If you use a capital letter to start products remember to use it. <br /> <br /> <form action="upload.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" size="120" name="file" id="file" /> <br /> <br /> <label for="title">product title:</label> <input type="text" size="25" name="title" id="title" /> <br /> <br /> <label for="discription">product discription:</label> <br /> <input type="text" size="160" name="discription" id="discription" /> <br /> <br /> <label for="category">category :</label> <input type="radio" name="category" value="bags"> bags <input type="radio" name="category" value="basques"> basques <input type="radio" name="category" value="bras"> bras <input type="radio" name="category" value="breast"> breast enhancers <input type="radio" name="category" value="briefs"> briefs <input type="radio" name="category" value="garters"> garters <input type="radio" name="category" value="hair"> hair <input type="radio" name="category" value="nightware"> nightware <input type="radio" name="category" value="hosiery"> hosiery <br /> <br /> <label for="group">linked product group id, no spaces please:</label> <input type="text" size="20" name="group" id="group" /><br /> <br /> <label for="hot">hot product:</label> <input type="radio" name="hot" value="1"> yes <input type="radio" name="hot" value="0"> no<br /> <br /> <label for="price">price:</label> <input type="text" size="10" name="price" id="price" /><br /> <br /> <label for="colour1">colour:</label> <input type="checkbox" name="colour1" value="ivory">ivory <input type="checkbox" name="colour2" value="white">white <input type="checkbox" name="colour3" value="nude">nude <input type="checkbox" name="colour4" value="black">black <br /><br /> <label for="a30">size 30:</label> <input type="checkbox" name="a30" value="1">a <input type="checkbox" name="b30" value="1">b <input type="checkbox" name="c30" value="1">c <input type="checkbox" name="d30" value="1">d <input type="checkbox" name="e30" value="1">dd <input type="checkbox" name="f30" value="1">f <input type="checkbox" name="g30" value="1">ff <input type="checkbox" name="h30" value="1">g <input type="checkbox" name="i30" value="1">all <br /><br /> <label for="a32">size 32:</label> <input type="checkbox" name="a32" value="1">a <input type="checkbox" name="b32" value="1">b <input type="checkbox" name="c32" value="1">c <input type="checkbox" name="d32" value="1">d <input type="checkbox" name="e32" value="1">dd <input type="checkbox" name="f32" value="1">f <input type="checkbox" name="g32" value="1">ff <input type="checkbox" name="h32" value="1">g <input type="checkbox" name="i32" value="1">all <br /><br /> <label for="a34">size 34:</label> <input type="checkbox" name="a34" value="1">a <input type="checkbox" name="b34" value="1">b <input type="checkbox" name="c34" value="1">c <input type="checkbox" name="d34" value="1">d <input type="checkbox" name="e34" value="1">dd <input type="checkbox" name="f34" value="1">f <input type="checkbox" name="g34" value="1">ff <input type="checkbox" name="h34" value="1">g <input type="checkbox" name="i34" value="1">all <br /><br /> <label for="a36">size 36:</label> <input type="checkbox" name="a36" value="1">a <input type="checkbox" name="b36" value="1">b <input type="checkbox" name="c36" value="1">c <input type="checkbox" name="d36" value="1">d <input type="checkbox" name="e36" value="1">dd <input type="checkbox" name="f36" value="1">f <input type="checkbox" name="g36" value="1">ff <input type="checkbox" name="h36" value="1">g <input type="checkbox" name="i36" value="1">all <br /><br /> <label for="a38">size 38:</label> <input type="checkbox" name="a38" value="1">a <input type="checkbox" name="b38" value="1">b <input type="checkbox" name="c38" value="1">c <input type="checkbox" name="d38" value="1">d <input type="checkbox" name="e38" value="1">dd <input type="checkbox" name="f38" value="1">f <input type="checkbox" name="g38" value="1">ff <input type="checkbox" name="h38" value="1">g <input type="checkbox" name="i38" value="1">all <br /><br /> <label for="a40">size 40:</label> <input type="checkbox" name="a40" value="1">a <input type="checkbox" name="b40" value="1">b <input type="checkbox" name="c40" value="1">c <input type="checkbox" name="d40" value="1">d <input type="checkbox" name="e40" value="1">dd <input type="checkbox" name="f40" value="1">f <input type="checkbox" name="g40" value="1">ff <input type="checkbox" name="h40" value="1">g <input type="checkbox" name="i40" value="1">all <br /><br /> <label for="a42">size 42:</label> <input type="checkbox" name="a42" value="1">a <input type="checkbox" name="b42" value="1">b <input type="checkbox" name="c42" value="1">c <input type="checkbox" name="d42" value="1">d <input type="checkbox" name="e42" value="1">dd <input type="checkbox" name="f42" value="1">f <input type="checkbox" name="g42" value="1">ff <input type="checkbox" name="h42" value="1">g <input type="checkbox" name="i42" value="1">all <br /><br /> <label for="a44">size 44:</label> <input type="checkbox" name="a44" value="1">a <input type="checkbox" name="b44" value="1">b <input type="checkbox" name="c44" value="1">c <input type="checkbox" name="d44" value="1">d <input type="checkbox" name="e44" value="1">dd <input type="checkbox" name="f44" value="1">f <input type="checkbox" name="g44" value="1">ff <input type="checkbox" name="h44" value="1">g <input type="checkbox" name="i44" value="1">all <br /><br /> <label for="a46">size 46:</label> <input type="checkbox" name="a46" value="1">a <input type="checkbox" name="b46" value="1">b <input type="checkbox" name="c46" value="1">c <input type="checkbox" name="d46" value="1">d <input type="checkbox" name="e46" value="1">dd <input type="checkbox" name="f46" value="1">f <input type="checkbox" name="g46" value="1">ff <input type="checkbox" name="h46" value="1">g <input type="checkbox" name="i46" value="1">all <br /><br /> <label for="a48">size 48:</label> <input type="checkbox" name="a48" value="1">a <input type="checkbox" name="b48" value="1">b <input type="checkbox" name="c48" value="1">c <input type="checkbox" name="d48" value="1">d <input type="checkbox" name="e48" value="1">dd <input type="checkbox" name="f48" value="1">f <input type="checkbox" name="g48" value="1">ff <input type="checkbox" name="h48" value="1">g <input type="checkbox" name="i48" value="1">all <br /><br /><br /> <input type="submit" name="submit" value="Submit" /></b> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/93431-product-information-form-how-to-store-info/#findComment-478673 Share on other sites More sharing options...
minxie6 Posted February 28, 2008 Author Share Posted February 28, 2008 <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo " error! e-mail mat!: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?><br /><br /> <? echo $_POST["name"]; ?><br /><? echo "upload/" . $_FILES["file"]["name"]; ?><br /> <? echo $_POST["title"]; ?><br /> <? echo $_POST["discription"]; ?><br /> <? echo $_POST["category"]; ?><br /> <? echo $_POST["group"]; ?><br /> <? echo $_POST["hot"]; ?><br /> <? echo$_POST["price"]; ?><br /> <? echo$_POST["colour"]; ?><br /> <? echo$_POST["a30"]; ?><br /> <? echo$_POST["a32"]; ?><br /> <? echo$_POST["a34"]; ?><br /> <? echo$_POST["a36"]; ?><br /> <? echo$_POST["a38"]; ?><br /> <? echo$_POST["a40"]; ?><br /> <? echo$_POST["a42"]; ?><br /> <? echo$_POST["a46"]; ?><br /> <? echo$_POST["a48"]; ?><br /> <br /> <? $username="lingerie_minxie6"; $password="blankedout"; $database="lingerie_data"; $con=mysql_connect ("localhost", "lingerie_minxie6", "none") or die ('I cannot connect to the database contact mat!: ' . mysql_error()); mysql_select_db ("lingerie_data"); $sql1="INSERT INTO product (filename, title, discription, category) VALUES ('$_POST[filename]','$_POST[title]','$_POST[discription]','$_POST[category]')"; if (!mysql_query($sql1,$con)) { die('Error product data1 contact mat!: ' . mysql_error()); } echo "product data1 added"; $sql2="INSERT INTO product (filename, group, hot, price) VALUES ('$_POST[filename]','$_POST[group]','$_POST[hot]','$_POST[price]')"; if (!mysql_query($sql2,$con)) { die('Error product data2 contact mat!: ' . mysql_error()); } echo "product data added 2"; $sql3="INSERT INTO product (filename, colour1, colour2) VALUES ('$_POST[filename]','$_POST[colour1]','$_POST[colour2]')"; if (!mysql_query($sql3,$con)) { die('Error product data3 contact mat!: ' . mysql_error()); } echo "product data added 3"; $sql4="INSERT INTO product (filename, colour3, colour4) VALUES ('$_POST[filename]','$_POST[colour3]','$_POST[colour4]')"; if (!mysql_query($sql4,$con)) { die('Error product data4 contact mat!: ' . mysql_error()); } echo "product data added 4"; $sql5="INSERT INTO size (filename, a30, a32, a34) VALUES ('$_POST[filename]','$_POST[a30]','$_POST[a32]','$_POST[a34]')"; if (!mysql_query($sql5,$con)) { die('Error product data5 contact mat!: ' . mysql_error()); } echo "product data added 5"; $sql6="INSERT INTO size (filename, a36, a38, a40) VALUES ('$_POST[filename]','$_POST[a36]','$_POST[a38]','$_POST[a40]')"; if (!mysql_query($sql6,$con)) { die('Error product data6 contact mat!: ' . mysql_error()); } echo "product data added 6"; $sql7="INSERT INTO product (filename, a42, a44, a46) VALUES ('$_POST[filename]','$_POST[a42]','$_POST[a44]','$_POST[a46]')"; if (!mysql_query($sql7,$con)) { die('Error product data7 contact mat!: ' . mysql_error()); } echo "product data added 7"; $sql8="INSERT INTO product (filename, a48) VALUES ('$_POST[filename]','$_POST[a48]')"; if (!mysql_query($sql8,$con)) { die('Error product data8 contact mat!: ' . mysql_error()); } echo "product data added 8"; mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/93431-product-information-form-how-to-store-info/#findComment-478677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.