Hello All, I am having problems resolving errors with some images causing the Undefined variable and getting property of non-object errors, I am trying to make a copy function so that an order can be viewed then resubmitted as a new order with minimal changes if needed. Here's my code: --could it be out of order as in the select should be above the insert? I bolded where the errors are happening. --------------------------------------------------------------------------------------- <?php error_reporting(E_ALL); ini_set('display_errors', '1'); session_start(); include("inc/dbconn_open.php"); if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] != true){ header ("Location: LogOut.php"); $_SESSION['user']=$UserName; } if (isset($_POST['AdminID'])){ $AdminID = $_POST['AdminID']; } elseif (isset($_GET['AdminID'])){ $AdminID = $_GET['AdminID']; } else { header ("Location: LogOut.php"); } if (isset($_POST['WorkOrderID'])){ $WorkOrderID = $_POST['WorkOrderID']; } elseif (isset($_GET['WorkOrderID'])){ $WorkOrderID = $_GET['WorkOrderID']; } else { header ("Location: LogOut.php"); } if (isset($_POST['ReturnPage'])){ $ReturnPage = $_POST['ReturnPage']; } elseif (isset($_GET['ReturnPage'])){ $ReturnPage = $_GET['ReturnPage']; } else { $ReturnPage = "Welcome.php"; } if (!empty($_POST['GO'])){$GO = $_POST['GO'];} else {$GO = "";} if (isset($_POST['Location'])){$Location = $_POST['Location'];} else {$Location = "";} if (isset($_POST['WorkOrderName'])){$WorkOrderName = $_POST['WorkOrderName'];} else {$WorkOrderName = "";} if (isset($_POST['IONumber'])){$IONumber = $_POST['IONumber'];} else {$IONumber = "";} if (isset ($_POST['AccountNum'])){$AccountNum = $_POST['AccountNum'];} else {$AccountNum = "";} if (!empty($_POST['BusinessName'])){$BusinessName = $_POST['BusinessName'];} else {$BusinessName = "";} if (!empty($_POST['URL'])){$URL = $_POST['URL'];} else {$URL = "";} if (!empty($_POST['Address1'])){$Address1 = $_POST['Address1'];} else {$Address1 = "";} if (!empty($_POST['Address2'])){$Address2 = $_POST['Address2'];} else {$Address2 = "";} if (!empty($_POST['City'])){$City = $_POST['City'];} else {$City = "";} if (!empty($_POST['State'])){$State = $_POST['State'];} else {$State = "";} if (!empty($_POST['Zip'])){$Zip = $_POST['Zip'];} else {$Zip = "";} if (!empty($_POST['Country'])){$Country = $_POST['Country'];} else {$Country = "";} if (!empty($_POST['Phone'])){$Phone = $_POST['Phone'];} else {$Phone = "";} if (!empty($_POST['TollFree'])){$TollFree = $_POST['TollFree'];} else {$TollFree = "";} if (!empty($_POST['Fax'])){$Fax = $_POST['Fax'];} else {$Fax = "";} if (!empty($_POST['Email'])){$Email = $_POST['Email'];} else {$Email = "";} if (!empty($_POST['Tagline'])){$Tagline = $_POST['Tagline'];} else {$Tagline = "";} if (!empty($_POST['Established'])){$Established = $_POST['Established'];} else {$Established = "";} if (!empty($_POST['StartMonth']) && !empty($_POST['StartDay']) && !empty($_POST['StartYear'])){ $StartDate = $_POST['StartYear'] ."-". $_POST['StartMonth'] ."-". $_POST['StartDay']; } else { $StartDate = ""; } if (!empty($_POST['EndMonth']) && !empty($_POST['EndDay']) && !empty($_POST['EndYear'])){ $EndDate = $_POST['EndYear'] ."-". $_POST['EndMonth'] ."-". $_POST['EndDay']; } else { $EndDate = ""; } if (!empty($_POST['PackageType'])){$PackageType = $_POST['PackageType'];} else {$PackageType = "";} if (!empty($_POST['BusinessType'])){$BusinessType = $_POST['BusinessType'];} else {$BusinessType = "";} if (!empty($_POST['MondayOpen'])){$MondayOpen = $_POST['MondayOpen'];} else {$MondayOpen = "";} if (!empty($_POST['MondayClose'])){$MondayClose = $_POST['MondayClose'];} else {$MondayClose = "";} if (!empty($_POST['TuesdayOpen'])){$TuesdayOpen = $_POST['TuesdayOpen'];} else {$TuesdayOpen = "";} if (!empty($_POST['TuesdayClose'])){$TuesdayClose = $_POST['TuesdayClose'];} else {$TuesdayClose = "";} if (!empty($_POST['WednesdayOpen'])){$WednesdayOpen = $_POST['WednesdayOpen'];} else {$WednesdayOpen = "";} if (!empty($_POST['WednesdayClose'])){$WednesdayClose = $_POST['WednesdayClose'];} else {$WednesdayClose = "";} if (!empty($_POST['ThursdayOpen'])){$ThursdayOpen = $_POST['ThursdayOpen'];} else {$ThursdayOpen = "";} if (!empty($_POST['ThursdayClose'])){$ThursdayClose = $_POST['ThursdayClose'];} else {$ThursdayClose = "";} if (!empty($_POST['FridayOpen'])){$FridayOpen = $_POST['FridayOpen'];} else {$FridayOpen = "";} if (!empty($_POST['FridayClose'])){$FridayClose = $_POST['FridayClose'];} else {$FridayClose = "";} if (!empty($_POST['SaturdayOpen'])){$SaturdayOpen = $_POST['SaturdayOpen'];} else {$SaturdayOpen = "";} if (!empty($_POST['SaturdayClose'])){$SaturdayClose = $_POST['SaturdayClose'];} else {$SaturdayClose = "";} if (!empty($_POST['SundayOpen'])){$SundayOpen = $_POST['SundayOpen'];} else {$SundayOpen = "";} if (!empty($_POST['SundayClose'])){$SundayClose = $_POST['SundayClose'];} else {$SundayClose = "";} if (!empty($_POST['BusinessCat'])){$BusinessCat = $_POST['BusinessCat'];} else {$BusinessCat = "";} if (!empty($_POST['Description'])){$Description = $_POST['Description'];} else {$Description = "";} if (!empty($_POST['Services'])){$Services = $_POST['Services'];} else {$Services = "";} if (!empty($_POST['Affiliations'])){$Affiliations = $_POST['Affiliations'];} else {$Affiliations = "";} if (!empty($_POST['Directions'])){$Directions = $_POST['Directions'];} else {$Directions = "";} if (!empty($_POST['Neighborhood'])){$Neighborhood = $_POST['Neighborhood'];} else {$Neighborhood = "";} if (!empty($_POST['Payment'])){$Payment = $_POST['Payment'];} else {$Payment = "";} if (!empty($_POST['Parking'])){$Parking = $_POST['Parking'];} else {$Parking = "";} if (!empty($_POST['Add_URL1'])){$Add_URL1 = $_POST['Add_URL1'];} else {$Add_URL1 = "";} if (!empty($_POST['Add_Text1'])){$Add_Text1 = $_POST['Add_Text1'];} else {$Add_Text1 = "";} if (!empty($_POST['Add_URL2'])){$Add_URL2 = $_POST['Add_URL2'];} else {$Add_URL2 = "";} if (!empty($_POST['Add_Text2'])){$Add_Text2 = $_POST['Add_Text2'];} else {$Add_Text2 = "";} if (!empty($_POST['Add_URL3'])){$Add_URL3 = $_POST['Add_URL3'];} else {$Add_URL3 = "";} if (!empty($_POST['Add_Text3'])){$Add_Text3 = $_POST['Add_Text3'];} else {$Add_Text3 = "";} if (isset($_POST['Salesperson'])){$Salesperson = $_POST['Salesperson'];} else {$Salesperson = "";} if (isset($_POST['SalespersonID'])){$SalespersonID = $_POST['SalespersonID'];} else {$SalespersonID = "";} if (isset($_POST['SalespersonEmail'])){$SalespersonEmail = $_POST['SalespersonEmail'];} else {$SalespersonEmail = "";} if (isset($_POST['SalespersonExt'])){$SalespersonExt = $_POST['SalespersonExt'];} else {$SalespersonExt = "";} if (!empty($_POST['Logo_Alt'])){$Logo_Alt = $_POST['Logo_Alt'];} else {$Logo_Alt = "";} if (!empty($_POST['Image1_Alt'])){$Image1_Alt = $_POST['Image1_Alt'];} else {$Image1_Alt = "";} if (!empty($_POST['Image2_Alt'])){$Image2_Alt = $_POST['Image2_Alt'];} else {$Image2_Alt = "";} if (!empty($_POST['Image3_Alt'])){$Image3_Alt = $_POST['Image3_Alt'];} else {$Image3_Alt = "";} if (!empty($_POST['Image4_Alt'])){$Image4_Alt = $_POST['Image4_Alt'];} else {$Image4_Alt = "";} if (!empty($_POST['Image5_Alt'])){$Image5_Alt = $_POST['Image5_Alt'];} else {$Image5_Alt = "";} if (!empty($_POST['Comments'])){$Comments = $_POST['Comments'];} else {$Comments = "";} if (isset($_POST['ExtraImage1Desc'])){$ExtraImage1Desc = $_POST['ExtraImage1Desc'];} else {$ExtraImage1Desc = "";} if (isset($_POST['ExtraImage2Desc'])){$ExtraImage2Desc = $_POST['ExtraImage2Desc'];} else {$ExtraImage2Desc = "";} if (isset($_POST['ExtraImage3Desc'])){$ExtraImage3Desc = $_POST['ExtraImage3Desc'];} else {$ExtraImage3Desc = "";} if (isset($_POST['ExtraImage4Desc'])){$ExtraImage4Desc = $_POST['ExtraImage4Desc'];} else {$ExtraImage4Desc = "";} if (isset($_POST['ExtraImage5Desc'])){$ExtraImage5Desc = $_POST['ExtraImage5Desc'];} else {$ExtraImage5Desc = "";} if ($GO == "Save") { $sql = "SELECT Name FROM admin WHERE AdminID='$AdminID'"; $result = mysql_query ($sql); * $row = mysql_fetch_object($result); this is giving me problems and I tried changing the object to assoc * $Notes = "~". date("F j, Y g:i a") ." - Planet Discover Enhanced Listing Submitted by ". $row->Name ."\n"; *This is the "trying to get property of non object"* $sql = "INSERT INTO workorders (CreatedDate, Location, WorkOrderName, AdminID, FormName, Status, Notes) VALUES ("; $sql .= "Now(), '$Location', '$WorkOrderName', '$AdminID', 'PD_Enhanced', 'New Order', '$Notes')"; mysql_query($sql); $WorkOrderID = mysql_insert_id(); if ($_FILES) { if (isset($_FILES['Logo'])) { if (is_uploaded_file ($_FILES['Logo']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['Logo']['name']))); $Logo = "ArtUpload/Artwork/". $WorkOrderID ."_Logo.". $ImageExt; move_uploaded_file($_FILES['Logo']['tmp_name'],$Logo); } } if (isset($_FILES['Image1'])) { if (is_uploaded_file ($_FILES['Image1']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['Image1']['name']))); $Image1 = "ArtUpload/Artwork/". $WorkOrderID ."_Image1.". $ImageExt; move_uploaded_file($_FILES['Image1']['tmp_name'],$Image1); } } if (isset($_FILES['Image2'])) { if (is_uploaded_file ($_FILES['Image2']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['Image2']['name']))); $Image2 = "ArtUpload/Artwork/". $WorkOrderID ."_Image2.". $ImageExt; move_uploaded_file($_FILES['Image2']['tmp_name'],$Image2); } } if (isset($_FILES['Image3'])) { if (is_uploaded_file ($_FILES['Image3']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['Image3']['name']))); $Image3 = "ArtUpload/Artwork/". $WorkOrderID ."_Image3.". $ImageExt; move_uploaded_file($_FILES['Image3']['tmp_name'],$Image3); } } if (isset($_FILES['Image4'])) { if (is_uploaded_file ($_FILES['Image4']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['Image4']['name']))); $Image4 = "ArtUpload/Artwork/". $WorkOrderID ."_Image4.". $ImageExt; move_uploaded_file($_FILES['Image4']['tmp_name'],$Image4); } } if (isset($_FILES['Image5'])) { if (is_uploaded_file ($_FILES['Image5']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['Image5']['name']))); $Image5 = "ArtUpload/Artwork/". $WorkOrderID ."_Image5.". $ImageExt; move_uploaded_file($_FILES['Image5']['tmp_name'],$Image5); } } if (isset($_FILES['ExtraImage1'])) { *then each of the "extraImage" are throwing the undefined variable error* if (is_uploaded_file ($_FILES['ExtraImage1']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['ExtraImage1']['name']))); $ExtraImage1Name = "ArtUpload/Artwork/". $WorkOrderID ."_Image1.". $ImageExt; move_uploaded_file($_FILES['ExtraImage1']['tmp_name'],$ExtraImage1Name); } } if (isset($_FILES['ExtraImage2'])) { if (is_uploaded_file ($_FILES['ExtraImage2']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['ExtraImage2']['name']))); $ExtraImage2Name = "ArtUpload/Artwork/". $WorkOrderID ."_Image2.". $ImageExt; move_uploaded_file($_FILES['ExtraImage2']['tmp_name'],$ExtraImage2Name); } } if (isset($_FILES['ExtraImage3'])) { if (is_uploaded_file ($_FILES['ExtraImage3']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['ExtraImage3']['name']))); $ExtraImage3Name = "ArtUpload/Artwork/". $WorkOrderID ."_Image3.". $ImageExt; move_uploaded_file($_FILES['ExtraImage3']['tmp_name'],$ExtraImage3Name); } } if (isset($_FILES['ExtraImage4'])) { if (is_uploaded_file ($_FILES['ExtraImage4']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['ExtraImage4']['name']))); $ExtraImage4Name = "ArtUpload/Artwork/". $WorkOrderID ."_Image4.". $ImageExt; move_uploaded_file($_FILES['ExtraImage4']['tmp_name'],$ExtraImage4Name); } } if (isset($_FILES['ExtraImage5'])) { if (is_uploaded_file ($_FILES['ExtraImage5']['tmp_name'])) { $ImageExt = strtolower(end(explode('.', $_FILES['ExtraImage5']['name']))); $ExtraImage5Name = "ArtUpload/Artwork/". $WorkOrderID ."_Image5.". $ImageExt; move_uploaded_file($_FILES['ExtraImage5']['tmp_name'],$ExtraImage5Name); } } } $sql = "INSERT INTO pd_enhanced (WorkOrderID, CreatedDate, IONumber, AccountNum, BusinessName, URL, Address1, Address2, City, State, Zip, Country, "; $sql .= "Phone, TollFree, Fax, Email, Tagline, Established, StartDate, EndDate, PackageType, BusinessType, MondayOpen, "; $sql .= "MondayClose, TuesdayOpen, TuesdayClose, WednesdayOpen, WednesdayClose, ThursdayOpen, ThursdayClose, FridayOpen, "; $sql .= "FridayClose, SaturdayOpen, SaturdayClose, SundayOpen, SundayClose, BusinessCat, Description, Services, "; $sql .= "Affiliations, Directions, Neighborhood, Payment, Parking, Add_URL1, Add_Text1, Add_URL2, Add_Text2, Add_URL3, "; $sql .= "Add_Text3, Salesperson, SalespersonID, SalespersonEmail, SalespersonExt, Logo, Logo_Alt, Image1, Image1_Alt, "; $sql .= "Image2, Image2_Alt, Image3, Image3_Alt, Image4, Image4_Alt, Image5, Image5_Alt, Comments, ExtraImage1, "; $sql .= "ExtraImage1Desc, ExtraImage2, ExtraImage2Desc, ExtraImage3, ExtraImage3Desc, ExtraImage4, ExtraImage4Desc, "; $sql .= "ExtraImage5, ExtraImage5Desc) VALUES ("; $sql .= "'". mysql_real_escape_string($WorkOrderID) ."', Now(), "; $sql .= "'". mysql_real_escape_string($IONumber) ."', "; $sql .= "'". mysql_real_escape_string($AccountNum) ."', "; $sql .= "'". mysql_real_escape_string($BusinessName) ."', "; $sql .= "'". mysql_real_escape_string($URL) ."', "; $sql .= "'". mysql_real_escape_string($Address1) ."', "; $sql .= "'". mysql_real_escape_string($Address2) ."', "; $sql .= "'". mysql_real_escape_string($City) ."', "; $sql .= "'". mysql_real_escape_string($State) ."', "; $sql .= "'". mysql_real_escape_string($Zip) ."', "; $sql .= "'". mysql_real_escape_string($Country) ."', "; $sql .= "'". mysql_real_escape_string($Phone) ."', "; $sql .= "'". mysql_real_escape_string($TollFree) ."', "; $sql .= "'". mysql_real_escape_string($Fax) ."', "; $sql .= "'". mysql_real_escape_string($Email) ."', "; $sql .= "'". mysql_real_escape_string($Tagline) ."', "; $sql .= "'". mysql_real_escape_string($Established) ."', "; $sql .= "'". mysql_real_escape_string($StartDate) ."', "; $sql .= "'". mysql_real_escape_string($EndDate) ."', "; $sql .= "'". mysql_real_escape_string($PackageType) ."', "; $sql .= "'". mysql_real_escape_string($BusinessType) ."', "; $sql .= "'". mysql_real_escape_string($MondayOpen) ."', "; $sql .= "'". mysql_real_escape_string($MondayClose) ."', "; $sql .= "'". mysql_real_escape_string($TuesdayOpen) ."', "; $sql .= "'". mysql_real_escape_string($TuesdayClose) ."', "; $sql .= "'". mysql_real_escape_string($WednesdayOpen) ."', "; $sql .= "'". mysql_real_escape_string($WednesdayClose) ."', "; $sql .= "'". mysql_real_escape_string($ThursdayOpen) ."', "; $sql .= "'". mysql_real_escape_string($ThursdayClose) ."', "; $sql .= "'". mysql_real_escape_string($FridayOpen) ."', "; $sql .= "'". mysql_real_escape_string($FridayClose) ."', "; $sql .= "'". mysql_real_escape_string($SaturdayOpen) ."', "; $sql .= "'". mysql_real_escape_string($SaturdayClose) ."', "; $sql .= "'". mysql_real_escape_string($SundayOpen) ."', "; $sql .= "'". mysql_real_escape_string($SundayClose) ."', "; $sql .= "'". mysql_real_escape_string($BusinessCat) ."', "; $sql .= "'". mysql_real_escape_string($Description) ."', "; $sql .= "'". mysql_real_escape_string($Services) ."', "; $sql .= "'". mysql_real_escape_string($Affiliations) ."', "; $sql .= "'". mysql_real_escape_string($Directions) ."', "; $sql .= "'". mysql_real_escape_string($Neighborhood) ."', "; $sql .= "'". mysql_real_escape_string($Payment) ."', "; $sql .= "'". mysql_real_escape_string($Parking) ."', "; $sql .= "'". mysql_real_escape_string($Add_URL1) ."', "; $sql .= "'". mysql_real_escape_string($Add_Text1) ."', "; $sql .= "'". mysql_real_escape_string($Add_URL2) ."', "; $sql .= "'". mysql_real_escape_string($Add_Text2) ."', "; $sql .= "'". mysql_real_escape_string($Add_URL3) ."', "; $sql .= "'". mysql_real_escape_string($Add_Text3) ."', "; $sql .= "'". mysql_real_escape_string($Salesperson) ."', "; $sql .= "'". mysql_real_escape_string($SalespersonID) ."', "; $sql .= "'". mysql_real_escape_string($SalespersonEmail) ."', "; $sql .= "'". mysql_real_escape_string($SalespersonExt) ."', "; $sql .= "'". mysql_real_escape_string($Logo) ."', "; $sql .= "'". mysql_real_escape_string($Logo_Alt) ."', "; $sql .= "'". mysql_real_escape_string($Image1) ."', "; $sql .= "'". mysql_real_escape_string($Image1_Alt) ."', "; $sql .= "'". mysql_real_escape_string($Image2) ."', "; $sql .= "'". mysql_real_escape_string($Image2_Alt) ."', "; $sql .= "'". mysql_real_escape_string($Image3) ."', "; $sql .= "'". mysql_real_escape_string($Image3_Alt) ."', "; $sql .= "'". mysql_real_escape_string($Image4) ."', "; $sql .= "'". mysql_real_escape_string($Image4_Alt) ."', "; $sql .= "'". mysql_real_escape_string($Image5) ."', "; $sql .= "'". mysql_real_escape_string($Image5_Alt) ."', "; $sql .= "'". mysql_real_escape_string($Comments) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage1Name) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage1Desc) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage2Name) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage2Desc) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage3Name) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage3Desc) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage4Name) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage4Desc) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage5Name) ."', "; $sql .= "'". mysql_real_escape_string($ExtraImage5Desc) ."')"; mysql_query($sql); ?> <?php exit(); } else { $sql = "SELECT BusinessName, URL, Address1, Address2, City, State, Zip, Country, Phone, TollFree, Fax, Email, Tagline, "; $sql .= "Established, DATE_FORMAT(StartDate, '%m') AS StartMonth, DATE_FORMAT(StartDate, '%e') AS StartDay, "; $sql .= "DATE_FORMAT(StartDate, '%Y') AS StartYear, DATE_FORMAT(EndDate, '%m') AS EndMonth, "; $sql .= "DATE_FORMAT(EndDate, '%e') AS EndDay, DATE_FORMAT(EndDate, '%Y') AS EndYear, PackageType, BusinessType, MondayOpen, "; $sql .= "MondayClose, TuesdayOpen, TuesdayClose, WednesdayOpen, WednesdayClose, ThursdayOpen, ThursdayClose, FridayOpen, "; $sql .= "FridayClose, SaturdayOpen, SaturdayClose, SundayOpen, SundayClose, BusinessCat, Description, Services, Affiliations, "; $sql .= "Directions, Neighborhood, Payment, Parking, Add_URL1, Add_Text1, Add_URL2, Add_Text2, Add_URL3, Add_Text3, "; $sql .= "Salesperson, SalespersonID, SalespersonEmail, SalespersonExt, Logo, Logo_Alt, Image1, Image1_Alt, Image2, "; $sql .= "Image2_Alt, Image3, Image3_Alt, Image4, Image4_Alt, Image5, Image5_Alt, Comments, ExtraImage1, ExtraImage1Desc, "; $sql .= "ExtraImage2, ExtraImage2Desc, ExtraImage3, ExtraImage3Desc, ExtraImage4, ExtraImage4Desc, ExtraImage5, "; $sql .= "ExtraImage5Desc FROM pd_enhanced WHERE WorkOrderID='$WorkOrderID'"; $result = mysql_query ($sql); $row = mysql_fetch_object ($result); $sql2 = "SELECT Location, WorkOrderName FROM workorders WHERE WorkOrderID='$WorkOrderID'"; $result2 = mysql_query ($sql2); $row2 = mysql_fetch_object ($result2); if (mysql_num_rows($result) == 0) { header ("Location: Welcome.php?AdminID=$AdminID&msg=Sorry, please try again."); } } ?>