473,394 Members | 1,810 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,394 software developers and data experts.

php notice: undefined variable

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()
{
search_by_index_value = 0;
jb_asc_desc_order = "A";


document.location = "jukeboxes.php?search_by_value="+search_by_index_v alue+"&jb_asc_desc_order_val="+jb_asc_desc_order;

}

</script>
<head>
</html>

<body>

<?php

@extract($_GET);
@extract($_POST);

if($search_by_value == "")
$search_by_value = 0;

if($jb_asc_desc_order_val == "D")
{
$order_by_string1 = "jukeboxes";
$order_by_string2 = "jukebox_serial";
$order = "desc";
}
?>

<table>
<tr>
<td><img src="images/list.jpg" alt="Click to list All Jukebox" width="50" height="13" align="absmiddle" onclick = "list_all_click()"></td>
</tr>
</table>

</body>

The above code is presented in 'jukeboxes.php' file that is variables are passed to the self php page through javascript.
It is working functionwise properly. I am getting expected output in the screen.
But the problem is that the following two warning messages is written in system 'error log' file.
message1:
"
[client 125.17.100.148] PHP Notice: Undefined variable: search_by_value in /var/www/html/dco/jukeboxes.php on line 362, referer: http://125.17.100.148/dco/company.php
"
Where the line 362 is
'if($search_by_value == "")'


message2:
"
[client 125.17.100.148] PHP Notice: Undefined variable: jb_asc_desc_order_val in /var/www/html/dco/jukeboxes.php on line 766, referer: http://125.17.100.148/dco/jukeboxes.php
"
Where the line 766 is
'if($jb_asc_desc_order_val == "D")'

The system has linux operating system.
I need to solve the problem as soon as possible.

Please help me.
Advance thanks.

regards
N.Prabhu
Sep 18 '06 #1
1 15262
Banfa
9,065 Expert Mod 8TB
If you just load the page with nothing on the URL after the ? then

$search_by_value
$jb_asc_desc_order_val

are not defined by the extract functions.

These are only information messages and could be ignored but to get rid of them change

[php]

if($search_by_value == "")
$search_by_value = 0;


if($jb_asc_desc_order_val == "D")
{
$order_by_string1 = "jukeboxes";
$order_by_string2 = "jukebox_serial";
$order = "desc";
}
[/php]

respectively to

[php]

if(!isset($search_by_value) || $search_by_value == "")
$search_by_value = 0;


if(isset($jb_asc_desc_order_val) && $jb_asc_desc_order_val == "D")
{
$order_by_string1 = "jukeboxes";
$order_by_string2 = "jukebox_serial";
$order = "desc";
}
else
{
/* Different values */
}
[/php]

isset is a function (well inbuilt operator really) that tests to see if a variable has been defined.
Sep 18 '06 #2

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...
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...
3
by: printline | last post by:
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 session_start();...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.