View previous topic :: View next topic |
Author |
Message |
egoo -
Joined: 22 Jan 2008 Posts: 16
|
Posted: Thu Jun 19, 2008 10:01 am Post subject: HTTP_SERVER_VARS |
|
|
Hi,
I'm using PHP Designer 2007 ver.5.4 ,but when I'm writing the PHP script below:
<?php
//create short variable name
$DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];//PHP Notice : Undefined HTTP_SERVER_VARS
$orders= file("$DOCUMENT_ROOT/../orders/orders.txt");
$number_of_orders = count($orders);
if ($number_of_orders == 0)
{
echo '<p><strong>No orders pending.
Please try again later.</strong></p>';
}
for ($i=0; $i<$number_of_orders; $i++)
{
echo $orders[$i].'<br />';
}
?>
Please correct the script ,so that the PHP Notice doesn't appear never more. Thank you in advance |
|
Back to top |
|
|
DonQuichote -
Joined: 24 Dec 2006 Posts: 68 Location: The Netherlands
|
Posted: Thu Jun 19, 2008 11:51 am Post subject: |
|
|
$HTTP_SERVER_VARS is deprecated for quite some time now. The better version is called $_SERVER. You can, however, still set the old superglobals in PHP.INI. |
|
Back to top |
|
|
egoo -
Joined: 22 Jan 2008 Posts: 16
|
Posted: Thu Jun 19, 2008 1:23 pm Post subject: HTTP_SERVER_VARS |
|
|
Well, but it is appear another PHP Notice:
<?php
//create short variable name
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];//PHP Notice:undefined index : DOCUMENT_ROOT
$orders= file("$DOCUMENT_ROOT/../orders/orders.txt");
$number_of_orders = count($orders);
if ($number_of_orders == 0)
{
echo '<p><strong>No orders pending.
Please try again later.</strong></p>';
}
for ($i=0; $i<$number_of_orders; $i++)
{
echo $orders[$i].'<br />';
}
?> |
|
Back to top |
|
|
|