-
Posts
780 -
Joined
-
Last visited
Everything posted by mikebyrne
-
At presnt Im not too worried about the validation. I just want the upload to save to the correct destination folder and a way to record the path details to pass into my database. If I could just get one part of this working it would be great
-
I only put up a snippet of my code. The full code is below <?PHP require_once("adminconnect.php"); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $Image = $_POST['Image']; $Image2 = $_POST['Image2']; // Where the file is going to be placed $target_path = "../Admin_files/Pictures/".$_FILES['uploadedfile']['name']; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $_FILES['uploadedfile']['tmp_name']; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } $tbl_name="product"; if($_POST["action"] == "Add"){ $valid=1; if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type<br>"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?<br>"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?<br>"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied<br>"; } if(empty($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the price<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Price']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_price = 'Price is invalid. Numbers only (eg: 123.05)'; } if(empty($_POST['Stockamount'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter a stock ammount<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Stockamount']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_amount = 'Ammonut is invalid. Numbers only (eg: 1,2,3)'; } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName,Stockamount,Display, Description,Price, Image, Image2) VALUES ('$Type','$ProductName','$Stockamount','$Display' ,'$Description', '$Price', '$Image', '$Image2')"; echo $_POST['Type']; echo $_POST['ProductName']; echo $_POST['Stockamount']; echo $_POST['Display']; echo $_POST['Description']; echo $_POST['Price']; echo $_POST['Image']; echo $_POST['Image2']; echo $sql; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../includes/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <form action="add.php" onsubmit="return valid()" method="post"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/start.php" class="black">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/postage.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/adminreg.php" class="black">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/add.php" class="black_on">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <!-- --> <!-- Double Space undernath CD --> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">EDIT ITEM</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="290" align="left">IMAGE</td> <td width="527">DETAIL</td> </tr> </table> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop1"> <!-- data Left start --> <div class="editLeft"> <!-- picture1 start --> <div class="editLeftBox">PICTURE 1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish --> <div class="padTop50"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- picture2 start --> <div class="editLeftBox">PICTURE 2:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </div> <div class="clr"> <!-- --> </div> <!-- picture2 finish --> </div> <!-- data Left finish --> <!-- data Right start --> <div class="editRight"> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Type:</div> <div class="editRightForm"> <select name="Type" class="000"> <option value="">------</option> returns $_POST['Type'] = "" <option value="Game" >GAME</option> returns $_POST['Type'] = "Game" <option value="DVD" >DVD</option> returns $_POST['Type'] = "DVD" <option value="CD" >CD</option> returns $_POST['Type'] = "CD" </select> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_type; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Name:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="ProductName" value="<?php $row['ProductName'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_name; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Description:</div> <div class="editRightForm"> <textarea type="text" class="itemEditForm03" name="Description" ><?php echo $row['Description'];?></textarea> <font color="#FF0000" style="font-size: 8pt"><?php echo $error_description; ?></font> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Stock Rec'd:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="Stockamount" value="<?php $row['Stockamount'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_amount; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Price:</div> <div class="editRightForm"> <div class="editItemPrice1">€</div> <div class="editItemPrice2"> <input type="text" class="itemEditForm04" name="Price" value="<?php $row['Price'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_price; ?></font></td> </div> <div class="clr"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> </div> <div class="editRadio4">hide</div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop75"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <!-- data Right finish --> </div> <div class="clr"> <!-- --> </div> <div class="padTop11"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dottedIn"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <!-- btn start --> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="btn"> <input type=hidden name=action value="Add"> <input type="submit" name="Submit" value="" style="border:0;background:url(../Admin_files/btn_update.gif) no-repeat;width:73px;height:23px;"> <div id="btnSpace"> <!-- --> </div> <input type="reset" value="" style="border:0;background:url(../Admin_files/btn_clear.gif) no-repeat;width:73px;height:23px;" onclick="return confirm('Are you sure you want to clear all data?')"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </div> </body> </html>
-
Im still getting the error even with the $target_path = "../Admin_files/Pictures/".$_FILES['uploadedfile']['name'];
-
I keep getting an error "There was an error uploading the file, please try again!" when Im trying to upload a file from my form. My Code: <?PHP require_once("adminconnect.php"); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $Image = $_POST['Image']; $Image2 = $_POST['Image2']; // Where the file is going to be placed $target_path = "../Admin_files/Pictures".$_FILES['uploadedfile']['name']; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $_FILES['uploadedfile']['tmp_name']; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } $tbl_name="product"; if($_POST["action"] == "Add"){ $valid=1; if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type<br>"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?<br>"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?<br>"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied<br>"; } if(empty($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the price<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Price']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_price = 'Price is invalid. Numbers only (eg: 123.05)'; } if(empty($_POST['Stockamount'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter a stock ammount<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Stockamount']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_amount = 'Ammonut is invalid. Numbers only (eg: 1,2,3)'; } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName,Stockamount,Display, Description,Price, Image, Image2) VALUES ('$Type','$ProductName','$Stockamount','$Display' ,'$Description', '$Price', '$Image', '$Image2')"; echo $_POST['Type']; echo $_POST['ProductName']; echo $_POST['Stockamount']; echo $_POST['Display']; echo $_POST['Description']; echo $_POST['Price']; echo $_POST['Image']; echo $_POST['Image2']; echo $sql; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); } } ?> <!-- picture1 start --> <div class="editLeftBox">PICTURE 1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish -->
-
Uploading pictre + storing destination address in a variable
mikebyrne replied to mikebyrne's topic in PHP Coding Help
I'll give that a try 1st thing in the morning. Thanks for your help! -
Uploading pictre + storing destination address in a variable
mikebyrne replied to mikebyrne's topic in PHP Coding Help
So in my case it would be $Image wouldnt it? -
Uploading pictre + storing destination address in a variable
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Its the " . $_FILES["file"]["name"] . "<br />"; bit I dont really get. What should go in ["file"]["name"] -
Ive just added a upload button to my form and what I really want the code to do is save the file in the specfied location (../Admin_files/Pictures) and save the target address to $Image which I will then pass to the database ie (../Admin_files/Pictures/Picture.jpeg) Im not too sure how to code the move_uploaded_file() // Where the file is going to be placed $target_path = "../Admin_files/Pictures"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $_FILES['uploadedfile']['tmp_name']; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } My complete code is <?PHP require_once("adminconnect.php"); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $Image = $_POST['Image']; $Image2 = $_POST['Image2']; $tbl_name="product"; if($_POST["action"] == "Add"){ $valid=1; if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type<br>"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?<br>"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?<br>"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied<br>"; } if(empty($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the price<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Price']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_price = 'Price is invalid. Numbers only (eg: 123.05)'; } if(empty($_POST['Stockamount'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter a stock ammount<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Stockamount']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_amount = 'Ammonut is invalid. Numbers only (eg: 1,2,3)'; } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName,Stockamount,Display, Description,Price, Image, Image2) VALUES ('$Type','$ProductName','$Stockamount','$Display' ,'$Description', '$Price', '$Image', '$Image2')"; echo $_POST['Type']; echo $_POST['ProductName']; echo $_POST['Stockamount']; echo $_POST['Display']; echo $_POST['Description']; echo $_POST['Price']; echo $_POST['Image']; echo $_POST['Image2']; echo $sql; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../includes/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <form action="add.php" onsubmit="return valid()" method="post"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/start.php" class="black">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/postage.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/adminreg.php" class="black">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/add.php" class="black_on">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <!-- --> <!-- Double Space undernath CD --> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">EDIT ITEM</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="290" align="left">IMAGE</td> <td width="527">DETAIL</td> </tr> </table> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop1"> <!-- data Left start --> <div class="editLeft"> <!-- picture1 start --> <div class="editLeftBox">PICTURE 1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish --> <div class="padTop50"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- picture2 start --> <div class="editLeftBox">PICTURE 2:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </div> <div class="clr"> <!-- --> </div> <!-- picture2 finish --> </div> <!-- data Left finish --> <!-- data Right start --> <div class="editRight"> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Type:</div> <div class="editRightForm"> <select name="Type" class="000"> <option value="">------</option> returns $_POST['Type'] = "" <option value="Game" >GAME</option> returns $_POST['Type'] = "Game" <option value="DVD" >DVD</option> returns $_POST['Type'] = "DVD" <option value="CD" >CD</option> returns $_POST['Type'] = "CD" </select> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_type; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Name:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="ProductName" value="<?php $row['ProductName'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_name; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Description:</div> <div class="editRightForm"> <textarea type="text" class="itemEditForm03" name="Description" ><?php echo $row['Description'];?></textarea> <font color="#FF0000" style="font-size: 8pt"><?php echo $error_description; ?></font> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Stock Rec'd:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="Stockamount" value="<?php $row['Stockamount'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_amount; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Price:</div> <div class="editRightForm"> <div class="editItemPrice1">€</div> <div class="editItemPrice2"> <input type="text" class="itemEditForm04" name="Price" value="<?php $row['Price'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_price; ?></font></td> </div> <div class="clr"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> </div> <div class="editRadio4">hide</div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop75"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <!-- data Right finish --> </div> <div class="clr"> <!-- --> </div> <div class="padTop11"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dottedIn"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <!-- btn start --> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="btn"> <input type=hidden name=action value="Add"> <input type="submit" name="Submit" value="" style="border:0;background:url(../Admin_files/btn_update.gif) no-repeat;width:73px;height:23px;"> <div id="btnSpace"> <!-- --> </div> <input type="reset" value="" style="border:0;background:url(../Admin_files/btn_clear.gif) no-repeat;width:73px;height:23px;" onclick="return confirm('Are you sure you want to clear all data?')"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </div> </body> </html>
-
Thanks, now just to figure out my uploading pictures problem and im done!!!
-
Once the validation process is complete I want all my details to pass into my product table but Im getting the error: CDlklklklklklkk77koojoioiououooo90INSERT INTO product (Producttype, ProductName,Stockamount,Display, Description,Price, Display, Image, Image2) VALUES ('CD','lklklklklklkk','77','YES' 'koojoioiououooo', '90', '', '')Column count doesn't match value count at row 1 With Query INSERT INTO product (Producttype, ProductName,Stockamount,Display, Description,Price, Display, Image, Image2) VALUES ('CD','lklklklklklkk','77','YES' 'koojoioiououooo', '90', '', '') The code Im using is <?PHP require_once("adminconnect.php"); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $Image = $_POST['Image']; $Image2 = $_POST['Image2']; $tbl_name="product"; if($_POST["action"] == "Add"){ $valid=1; if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type<br>"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?<br>"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?<br>"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied<br>"; } if(empty($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the price<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Price']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_price = 'Price is invalid. Numbers only (eg: 123.05)'; } if(empty($_POST['Stockamount'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter a stock ammount<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Stockamount']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_amount = 'Ammonut is invalid. Numbers only (eg: 1,2,3)'; } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName,Stockamount,Display, Description,Price, Display, Image, Image2) VALUES ('$Type','$ProductName','$Stockamount','$Display' '$Description', '$Price', '$Image', '$Image2')"; echo $_POST['Type']; echo $_POST['ProductName']; echo $_POST['Stockamount']; echo $_POST['Display']; echo $_POST['Description']; echo $_POST['Price']; echo $_POST['Image']; echo $_POST['Image2']; echo $sql; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); } } ?>
-
What I really want the code to do is save the file in the specfied location and save the target to $Image which I will then pass to the database
-
I've been trying to put it together // Where the file is going to be placed $target_path = "../Admin_files/Pictures"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $_FILES['uploadedfile']['tmp_name']; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } Just not sure how to apply it to my existing code In my case I have a varible set aside $Image = $_POST['Image'];
-
Days pulling my hair out!! Dont you just love coding sometimes!!
-
I've just coded an upload button to my page and was wondering how I would code the php around the button to save the files in a specfic location. In my case the location is ./Admin_files/Pictures My code for the picture upload is <!-- picture1 start --> <div class="editLeftBox">PICTURE 1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </div> <div class="clr">
-
Fixed the problem!! $price_error should have been $error_price!!!!!!
-
The output is 12.1 Is NOT Valid .12 Is NOT Valid .1 Is NOT Valid 12. Is NOT Valid 1,123.1 Is NOT Valid a1,123.1 Is NOT Valid 1,f123.1 Is NOT Valid 1,123.s1 Is NOT Valid 1,123.1f Is NOT Valid fadg.1 Is NOT Valid 1,123.sd Is NOT Valid gds.f Is NOT Valid sdgsdg Is NOT Valid 12 Is Valid 12.12 Is Valid 0.12 Is Valid 123.12 Is Valid 1,123.12 Is Valid
-
The pregmatch seems to be failing as I dont get an error if I put in letters for the price but i get an error if the Price textbox is left blank <?PHP require_once("adminconnect.php"); $ProductNo = mysql_real_escape_string(trim($_POST['ProductNo'])); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $tbl_name="product"; if($_POST["action"] == "Add"){ $valid=1; if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type<br>"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?<br>"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?<br>"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied<br>"; } if(empty($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the price<br>"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Price']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $price_error = 'Price is invalid. Numbers only (eg: 123.05)'; } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName, Description,Price, Stockamount, Display) VALUES ('$Type','$ProductName', '$Description', '$Price','$Stockamount''$Display')";
-
This still doesnt produce and error if I type in letters instead of numeric values. Im pretty sure it to do with if(isset($_POST['Price'])) { $valid = 1; My complete code <?PHP require_once("adminconnect.php"); $ProductNo = mysql_real_escape_string(trim($_POST['ProductNo'])); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $tbl_name="product"; if($_POST["action"] == "Add"){ $valid=1; if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type<br>"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?<br>"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?<br>"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied<br>"; } if(isset($_POST['Price'])) { $valid = 1; if(empty($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the price<br>"; } elseif(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$number) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $price_error = 'Price is invalid. Numbers only (eg: 123.05)'; } } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName, Description,Price, Stockamount, Display) VALUES ('$Type','$ProductName', '$Description', '$Price','$Stockamount''$Display')"; [\code]
-
How can I apply this to my "Price" validation really not sure how to code your example with mine
-
It just euros and cents. Id rather have it as it is but I cant get the validation to work and its driving me mental
-
Im trying to code my text box for "PRICE" so the user cannot leave it blank and can only enter numeric values. At present the validation works if I leave it blank but doesnt validate for numeric values at present My validation <?PHP require_once("adminconnect.php"); $ProductNo = mysql_real_escape_string(trim($_POST['ProductNo'])); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $tbl_name="product"; if($_POST["action"] == "Add"){ $valid=1; if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type<br>"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?<br>"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?<br>"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied<br>"; } if(isset($_POST['Price'])) { $valid = 1; if(empty($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the price<br>"; } elseif(!is_numeric($_POST['Price'])) { $valid = 0; $style_name = "background-color:#FF5959"; $price_error = 'Price is invalid. Numbers only (eg: 123.45)'; } } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName, Description,Price, Stockamount, Display) VALUES ('$Type','$ProductName', '$Description', '$Price','$Stockamount''$Display')"; ?> <input type="text" class="itemEditForm04" name="Price" value="<?php $row['Price'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_price; ?></font></td>
-
Having a browse button to refer to one folder only?
mikebyrne replied to mikebyrne's topic in PHP Coding Help
There isnt any yet. My problem is that I want the user to only upload to a certain folder as opposed to saving it anywhere -
Having a browse button to refer to one folder only?
mikebyrne replied to mikebyrne's topic in PHP Coding Help
The problem is that im not sure where or how to code it so the user is restricted. Do I code around the browse button itself or is it a seperate php command? My completed code is <?PHP require_once("adminconnect.php"); $ProductNo = mysql_real_escape_string(trim($_POST['ProductNo'])); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $tbl_name="product"; if($_POST["action"] == "Add"){ $valid=1; if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type<br>"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?<br>"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?<br>"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied<br>"; } if ($_POST['Price']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the product price<br>"; } if(!is_numeric($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price1 = "Please enter numeric values only"; } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName, Description,Price, Stockamount, Display) VALUES ('$Type','$ProductName', '$Description', '$Price','$Stockamount''$Display')"; echo $_POST['ProductNo']; echo $_POST['ProductName']; echo $_POST['Description']; echo $_POST['Price']; echo $_POST['Stockamount']; echo $_POST['Type']; echo $_POST['Display']; echo $sql; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../includes/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <form action="add.php" onsubmit="return valid()" method="post"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/start.php" class="black">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/postage.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/adminreg.php" class="black">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/add.php" class="black_on">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <!-- --> <!-- Double Space undernath CD --> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">EDIT ITEM</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="290" align="left">IMAGE</td> <td width="527">DETAIL</td> </tr> </table> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop1"> <!-- data Left start --> <div class="editLeft"> <!-- picture1 start --> <div class="editLeftBox">PICTURE 1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="file" name="uploadfile" class="newsUpFile"> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish --> <div class="padTop50"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- picture2 start --> <div class="editLeftBox">PICTURE 2:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="file" name="uploadfile" class="newsUpFile"> </div> <div class="clr"> <!-- --> </div> <!-- picture2 finish --> </div> <!-- data Left finish --> <!-- data Right start --> <div class="editRight"> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Type:</div> <div class="editRightForm"> <select name="Type" class="000"> <option value="">------</option> returns $_POST['Type'] = "" <option value="Game" >GAME</option> returns $_POST['Type'] = "Game" <option value="DVD" >DVD</option> returns $_POST['Type'] = "DVD" <option value="CD" >CD</option> returns $_POST['Type'] = "CD" </select> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_type; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Name:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="ProductName" value="<?php $row['ProductName'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_name; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Description:</div> <div class="editRightForm"> <textarea type="text" class="itemEditForm03" name="Description" > font color="#FF0000" style="font-size: 8pt<?php echo $error_description; ?> <?php $row['Description'];?> </textarea> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Stock Rec'd:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="Stockamount" value="<?php $row['Stockamount'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_amount; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Price:</div> <div class="editRightForm"> <div class="editItemPrice1">€</div> <div class="editItemPrice2"> <input type="text" class="itemEditForm04" name="Price" value="<?php $row['Price'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_price; ?><?php echo $error_price1; ?></font></td> </div> <div class="clr"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> </div> <div class="editRadio4">hide</div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop75"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <!-- data Right finish --> </div> <div class="clr"> <!-- --> </div> <div class="padTop11"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dottedIn"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <!-- btn start --> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="btn"> <input type=hidden name=action value="Add"> <input type="submit" name="Submit" value="" style="border:0;background:url(../Admin_files/btn_update.gif) no-repeat;width:73px;height:23px;"> <div id="btnSpace"> <!-- --> </div> <input type="reset" value="" style="border:0;background:url(../Admin_files/btn_clear.gif) no-repeat;width:73px;height:23px;" onclick="return confirm('Are you sure you want to clear all data?')"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </div> </body> </html> -
Having a browse button to refer to one folder only?
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Sorry you've lost me. What do you mean make the user put it where u want?? -
Having a browse button to refer to one folder only?
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Sorry, the user can potentially save the picture files anywhere ie desktop Z: drive etc is it possible to code the browse button so it only point to specfic location. In my case ../admin_files/Picrtures