Use of undefined constant

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ullasvk
Forum Newbie
Posts: 21
Joined: Fri Feb 13, 2009 11:55 pm

Use of undefined constant

Post by ullasvk »

Plz Any one Help Me.
An Eroor occured when using for loop
the code is
<?php
include ("includes/connection.php");
include ("includes/functions.php");
if (isset($_REQUEST['submit']))
{
if (($_REQUEST['dealer'] != "") && ($_REQUEST['cur_date'] != "") && ($_REQUEST['disp_date'] !="") && ($_REQUEST['density'] != "") && ($_REQUEST['size'] != "") && ($_REQUEST['thick'] !="") && ($_REQUEST['no_of_bun'] != "") && ($_REQUEST['grade'] != "") && ($_REQUEST['color'] !=""))
{
$result = mysql_query("INSERT INTO ORDER_NO VALUES('','" . $_REQUEST["dealer"] . "','" . $_REQUEST["cur_date"] ."','" . $_REQUEST["disp_date"] . "','0');");
$or_id = mysql_insert_id();
if (is_array($_REQUEST['thick']))
{
for ($i = 0; $i < count($_REQUEST['thick']); $i++)
{
for ($j = 0; $j < $_REQUEST['no_of_bun']; $j++)
{
mysql_query("INSERT INTO ORDER_DETAIL VALUES('','" . $or_id . "','" . $_REQUEST["density"] ."','" . $_REQUEST["size"] . "','" . $_REQUEST["thick"] . "','" . $_REQUEST["no_of_bun"] ."','" . $_REQUEST["grade"] . "','" . $_REQUEST["color"] . "');");
}
}
popup('Database array updated', 'New_Order.php');
}
else
{
for ($k = 0; $k < $_REQUEST['no_of_bun']; $k++)

{
mysql_query("INSERT INTO ORDER_DETAIL VALUES('','" . $or_id . "','" . $_REQUEST["density"][k] ."','" . $_REQUEST["size"][k] . "','" . $_REQUEST["thick"][k] . "','" . $_REQUEST["no_of_bun"][k] ."','" . $_REQUEST["grade"][k] . "','" . $_REQUEST["color"][k] . "',);");
}
}
//popup('Database not updated', 'New_Order.php');
}
else
{
popup('Enter All Entries, Database Not Updated', 'New_Order.php');
}
}
?>
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Use of undefined constant

Post by requinix »

You already have this thread. Don't create another, especially if it's absolutely worthless.
Also, edit your post and put your code in [ code=php ][ /code ] tags. Remove the extra spaces.
Also, use English. I hate people who say "plz" and can't/won't spell simple words like "error" correctly. You'd be amazed what people think of you if you act like you have an education.

Code: Select all

$_REQUEST['no_of_bun'][i]
Everytime you use "i" or "k" in your code, without a $, PHP thinks it's a constant. It isn't.
Use a $ just like you did at the beginning of the loops.
Post Reply