473,811 Members | 3,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php notice: undefined variable

10 New Member
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_ord er = "A";


document.locati on = "jukeboxes.php? search_by_value ="+search_by_in dex_value+"&jb_ asc_desc_order_ val="+jb_asc_de sc_order;

}

</script>
<head>
</html>

<body>

<?php

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

if($search_by_v alue == "")
$search_by_valu e = 0;

if($jb_asc_desc _order_val == "D")
{
$order_by_strin g1 = "jukeboxes" ;
$order_by_strin g2 = "jukebox_serial ";
$order = "desc";
}
?>

<table>
<tr>
<td><img src="images/list.jpg" alt="Click to list All Jukebox" width="50" height="13" align="absmiddl e" 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_ord er_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_des c_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 15281
Banfa
9,065 Recognized Expert Moderator Expert
If you just load the page with nothing on the URL after the ? then

$search_by_valu e
$jb_asc_desc_or der_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_v alue == "")
$search_by_valu e = 0;


if($jb_asc_desc _order_val == "D")
{
$order_by_strin g1 = "jukeboxes" ;
$order_by_strin g2 = "jukebox_serial ";
$order = "desc";
}
[/php]

respectively to

[php]

if(!isset($sear ch_by_value) || $search_by_valu e == "")
$search_by_valu e = 0;


if(isset($jb_as c_desc_order_va l) && $jb_asc_desc_or der_val == "D")
{
$order_by_strin g1 = "jukeboxes" ;
$order_by_strin g2 = "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
7660
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 "Notice: Undefined variable loginmsg" warning. I've had a good look at previous posts concerning this warning, and see that isset() is recommended to prevent this kind of warning. Is this totally necessary? In ASP, and include file becomes...
4
7333
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
5505
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: Undefined index: FriendName in D:\Yan\Over_8\SendEmail.php on line 4, Notice: Undefined index: FriendEmail in D:\Yan\Over_8\SendEmail.php on line 5, Notice: Undefined index: Name in D:\Yan\Over_8\SendEmail.php on line 6, Notice: Undefined index: Email...
2
10636
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 line 7 Notice: Undefined variable: uploaded_type in /home/fhlinux169/c/ clashoff.co.uk/user/htdocs/upload.php on line 14 Notice: Undefined index: uploadedfile in /home/fhlinux169/c/
3
4548
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(); session_register("LoggedIn"); session_register("SavedSearchType");
5
6691
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 I load my test.php file into the browser. PHP Notice: Undefined index: variable in Path to page on line 24 The line in question is this $query1="insert into tablename ('var','var1','var2','var3','var4','var5','var6') values ('" ....
5
7371
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 : $http_ref= $HTTP_REFERER; $prog = $_COOKIE;
1
2747
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 company did an upgrade and it seems to coincide with that. The Notice is at the top of the page, but the rest of the page displays normally and form still works. I don't get the Notice when I test the page on the local Apache server in the XAMPP...
10
3277
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 initializing my variables. I am running into a problem with my $_POST array though. I am self-referencing a form page for processing, so at the beginning I am looking for the existence of certain $_POST variables for processing. I am setting an...
0
9724
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9201
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.