[PHP] Need Help resolving the undefined variable and getting property of non-object errors

2009-01-27 Thread Terion Miller
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 

Re: [PHP] Need Help resolving the undefined variable and getting property of non-object errors

2009-01-27 Thread Stuart
2009/1/27 Terion Miller webdev.ter...@gmail.com:
 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.

Holy crap on a cracker, I'm not gonna read all that.

An undefined variable notice basically means you're trying to use a
variable before it's been given a value, so look for that on and
around the line it complains about and either display the variables or
trace them back to confirm they contain what you think they do.

The other error indicates that you're trying to use object notation
(-) on a scalar (number, string or array). Again, look at the line it
points you to and confirm the variables it contains have the values
you think they should.

This is basic debugging. Spending time resolving these errors yourself
is time well spent, and the more you do it the easier it becomes.

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php