473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP Notice: Undefined variable

Can anyone help me with why i am getting this error message:

Notice: Undefined variable: SalesRepID in C:\Inetpub\wwwroot\index.php on line 158

Here is my php code:

[PHP]<?php
session_start();
session_register("LoggedIn");
session_register("SavedSearchType");
session_register("ShowDetails");
session_register("SalesRepID");
session_register("SavedCustID");
session_register("LinesToDisplay");
session_register("StatusREL");
session_register("StatusSHP");
session_register("StatusINV");
session_register("StatusNR");
session_register("SavedFromDate");
session_register("SavedToDate");
session_register("WebCompanyName");
session_register("SavedSearchValue");
session_register("SavedSearchRev");
session_register("SavedQueryOrder");
session_register('WebUserType');


if (!isset($_POST['FromDate'])) {
$_POST['FromDate'] = $_SESSION['SavedFromDate'];
}
$_SESSION['SavedFromDate'] = $_POST['FromDate'];
if (!isset($_POST['ToDate'])) {
$_POST['ToDate'] = $_SESSION['SavedToDate'];
}
$_SESSION['SavedToDate'] = $_POST['ToDate'];

if (!isset($_POST['StatusREL'])) {
$_POST['StatusREL'] = $_SESSION['StatusREL'];
}
$_SESSION['StatusREL'] = $_POST['StatusREL'];
if (!isset($_POST['StatusSHP'])) {
$_POST['StatusSHP'] = $_SESSION['StatusSHP'];
}
$_SESSION['StatusSHP'] = $_POST['StatusSHP'];
if (!isset($_POST['StatusINV'])) {
$_POST['StatusINV'] = $_SESSION['StatusINV'];
}
$_SESSION['StatusINV'] = $_POST['StatusINV'];
if (!isset($_POST['StatusNR'])) {
$_POST['StatusNR'] = $_SESSION['StatusNR'];
}
$_SESSION['StatusNR'] = $_POST['StatusNR'];

if (!isset($_SESSION['StatusREL'])) { $_SESSION['StatusREL'] = "OFF"; }
if (!isset($_SESSION['StatusSHP'])) { $_SESSION['StatusSHP'] = "OFF"; }
if (!isset($_SESSION['StatusINV'])) { $_SESSION['StatusINV'] = "OFF"; }
if (!isset($_SESSION['StatusNR'])) { $_SESSION['StatusNR'] = "OFF"; }

if (!isset($_POST['CustID'])) {
$_POST['CustID'] = trim($_SESSION['SavedCustID']);
}

$_SESSION['SavedCustID'] = "All";
if (trim($_SESSION['ShowDetails']) == "Y") {
if (trim($_SESSION['WebUserType']) == "Rep") {
$_SESSION['SavedCustID'] = trim($_POST['CustID']);
}}


if (!isset($_POST['LinesToDisplay'])) {
$_POST['LinesToDisplay'] = $_SESSION['LinesToDisplay'];
}
$_SESSION['LinesToDisplay'] = $_POST['LinesToDisplay'];

if (!isset($_POST['SearchType'])) {
$_POST['SearchType'] = $_SESSION['SavedSearchType'];
}
$_SESSION['SavedSearchType'] = $_POST['SearchType'];

if (!isset($_POST['SearchValue'])) {
$_POST['SearchValue'] = $_SESSION['SavedSearchValue'];
}
$_SESSION['SavedSearchValue'] = $_POST['SearchValue'];

if (!isset($_POST['SearchRev'])) {
$_POST['SearchRev'] = $_SESSION['SavedSearchRev'];
}
$_SESSION['SavedSearchRev'] = $_POST['SearchRev'];

if (!isset($_POST['QueryOrder'])) {
$_POST['QueryOrder'] = $_SESSION['SavedQueryOrder'];
}
$_SESSION['SavedQueryOrder'] = $_POST['QueryOrder'];


if ($_SESSION['LoggedIn'] != true) {
@include("login.php");
return;
}


include("./connopenphp.inc");
//url definitions for shippers
$upsurl = "http://wwwapps.ups.com/tracking/tracking.cgi?tracknum=";
$fedxurl = "http://www.fedex.com/cgi-bin/tracking?action=track&language=english&cntry_code= us&initial=x&tracknumbers=";

// Status images are now user defineable in system parameters
$StatusToBeBuilt = "images/";
$StatusMFG = "images/";
$StatusPackaging = "images/";
$StatusUPS = "images/";
$StatusFedX = "images/";
$StatusUSPS = "images/";
$query = "select * from SYSPARMS";
$result = mssql_query($query,$conn);
if (mssql_num_rows($result) > 0) {
$sysparms = mssql_fetch_array($result);
$StatusToBeBuilt = "images/" . trim($sysparms['StatusImageToBeBuilt']);
$StatusMFG = "images/" . trim($sysparms['StatusImageMFG']);
$StatusPackaging = "images/" . trim($sysparms['StatusImagePackaging']);
$StatusUPS = "images/" . trim($sysparms['StatusImageUPS']);
$StatusFedX = "images/" . trim($sysparms['StatusImageFedX']);
$StatusUSPS = "images/" . trim($sysparms['StatusImageUSPS']);
}
if (trim($StatusToBeBuilt) == "images/") { $StatusToBeBuilt = "images/styello.gif";}
if (trim($StatusMFG) == "images/") { $StatusMFG = "images/stblue.gif";}
if (trim($StatusPackaging) == "images/") { $StatusPackaging = "images/stbrown.gif";}
if (trim($StatusUPS) == "images/") { $StatusUPS = "images/stgreen.gif";}
if (trim($StatusFedX) == "images/") { $StatusFedX = "images/stgreen.gif";}
if (trim($StatusUSPS) == "images/") { $StatusUSPS = "images/stgreen.gif";}



$a = trim($_SESSION['UserID']);
$b = trim($_SESSION['Password']);
$query = "select * from USERINFO where (UserID = '" . $a . "' and Password = '" . $b . "')";
// print($query);
$result = mssql_query($query,$conn);
if (mssql_num_rows($result) > 0) {
$userinfo = mssql_fetch_array($result);
$CompanyName = $userinfo['CompanyName'];
$Addr1 = $userinfo['Addr1'];
$Addr2 = $userinfo['Addr2'];
$City = $userinfo['City'];
$State = $userinfo['State'];
$Zip = $userinfo['Zip'];
$Country = $userinfo['Country'];
$Phone = $userinfo['Phone'];
$CustID = trim($userinfo['CustID']);
} else {
$CompanyName = "";
$Addr1 = "";
$Addr2 = "";
$City = "";
$State = "";
$Zip = "";
$Country = "";
$Phone = "";
$CustID = "";
}

$_SESSION['zPage'] = 1;
$FoundCust = false;
if ($SalesRepID != "") {
$query = "select * from CUST where (SalesRep1 = '" . $SalesRepID . "')";
$query = $query . " or (SalesRep2 = '" . $SalesRepID . "')";
$query = $query . " or (SalesRep3 = '" . $SalesRepID . "')";
$query = $query . " or (SalesRep4 = '" . $SalesRepID . "')";
$result = mssql_query($query,$conn);
if ($result == true) {
$FoundCust = true;
}
}
$Base64user_name = base64_encode($_SESSION['UserID']);
//echo "user is $_SESSION[CurrentlyLoggedInUser]<br>";
//echo "<pre>";
//print_r($_SESSION);
//echo "</pre>";
?>[/PHP]
Aug 22 '07 #1
3 4519
nathj
938 Expert 512MB
Hi printline

It looks to me like you have registered the session variable but not a local variable. So when you try to use $SalesRepID it hasn't been defined. Try defining the variable first and run the code again.

Cheers
nathj
Aug 22 '07 #2
That helped....

Thanks a lot.......
Aug 22 '07 #3
pbmods
5,821 Expert 4TB
Heya, printline.

Instead of:
Expand|Select|Wrap|Line Numbers
  1. if ($SalesRepID != "") {
  2.  
Try this:
Expand|Select|Wrap|Line Numbers
  1. if ( ! empty($SalesRepID) )
  2. {
  3.  
P.S. Changed thread title to better describe the problem (did you know that threads whose titles contain three words or less actually get FEWER responses?).
Aug 22 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike | last post by:
I'm new to PHP - moving over from ASP. I have a number of include files, the first of which sets the value of a variable $loginmsg. I use that variable in a subsequent include file, but get a...
1
by: prabhunew2005 | last post by:
hi I am doing web portal design using php. I gave part of one of my screen coding. <html> <head> <script language = "javascript"> function list_all_click()
4
by: dmain1971 | last post by:
I have a class with an empty array like so: private $detail = array(); Then I have a function later on in the class: function get_array_value() { $detail_info = ' ';
3
by: number1yan | last post by:
Can anyone help me, i am creating a website and am using a php script that recomends the website to other people. I keep getting the same error and can not work out why. The error is: Notice:...
2
by: Reggie | last post by:
am trying to create a a upload file.am uploading files ok but i recieve this message. Notice: Undefined variable: uploaded_size in /home/fhlinux169/c/ clashoff.co.uk/user/htdocs/upload.php on...
5
by: movieking81 | last post by:
Another PHP newbie here, I trolled the boards here trying some of the different solutions but I keep getting the errors over an over. maybe my problem is specific. I keep getting the following when...
5
by: Pseudonyme | last post by:
Dear All : Ever had an httpd error_log bigger than the httpd access log ? We are using Linux-Apache-Fedora-Httpd 2006 configuration. The PHP lines code that lead too tons of errors are : ...
1
by: francsutherland | last post by:
Notice: Undefined index: send in D:\Domains\workingdata.co.uk\wwwroot\contact_text.php on line 7 Hi, I've started getting this error in the contact page form of my website. The web hosting...
10
by: FutureShock | last post by:
I have since recently turned up my error reporting on a production site to E_ALL to ensure I am using 'best practices' when writing out code. So far it has helped me discipline myself with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.