[PHP] Using $PHP_SELF

2003-07-31 Thread Buntin, Seth - KATE
I am having problems while transfering information to another page.  I
am using $PHP_SELF and I am getting errors here is a bit of code so you
can see what I am saying:
 
echo a href='$PHP_SELF?file=$filedir=.$mydir.'$file/aBR\n;
 
This is what the browser is saying...
Notice: Undefined variable: PHP_SELF in
c:\inetpub\wwwroot\test\download.php on line 54
 
I don't know what to do.


Re: [PHP] Using $PHP_SELF

2003-07-31 Thread Matt Matijevich
try $_SERVER[PHP_SELF]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using $PHP_SELF

2003-07-31 Thread David Otton
On Thu, 31 Jul 2003 15:38:41 -0500, you wrote:

I am having problems while transfering information to another page.  I
am using $PHP_SELF and I am getting errors here is a bit of code so you
can see what I am saying:
 
echo a href='$PHP_SELF?file=$filedir=.$mydir.'$file/aBR\n;
 
This is what the browser is saying...
Notice: Undefined variable: PHP_SELF in
c:\inetpub\wwwroot\test\download.php on line 54
 
I don't know what to do.

either

you have register_globals turned off and should use $_SERVER['PHP_SELF']

or

you are attempting to use $PHP_SELF within a function, without having
declared it global first.

function test() {
global $PHP_SELF;
echo ($PHP_SELF);
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using $PHP_SELF in a form

2002-06-24 Thread Frank Miller








Hello All,

 Im working on a project here
at our university and need a little. We installed a wireless network and
bought 5 ipaqs to use and experiment with. I wrote a work order system
that we are still using. Basically the tech guys want to be able to check WO
from the ipaqs and if they finish them fill in a check box and have it
be updated in the WO database and not be displayed on the open or uncompleted
work order page. I can do everything except when the completed box is filled I
cant get it to fill in the database. Below is the code Im using.
Keep in mind it is being displayed on a ipaq so the headings are brief. Also Im
working on my local computer before it is put in production. Any help would be
appreciated. 



TIA  Frank



?php

if(!$HTTP_POST_VARS['submit']) {





// initialize database connection

$connection = mysql_connect(localhost) or

die(Couldn't connect to the database!);

// select database

mysql_select_db(techsupport, $connection);

//formulate and run query

$query = SELECT * FROM techsupport where (Completed =
'N' or Completed = 'n') and TCompleted='N' ORDER by WONumber DESC;

$result = mysql_query($query,$connection) or die(Error
in Query);



$per_page = 10;

if(!$page) {

 $page = 1; 

}

$prev_page = $page - 1;

$next_page = $page + 1;



$page_start = ($per_page * $page ) - $per_page;

$num_rows = mysql_num_rows($result);



if ($num_rows = $per_page) {

 $num_pages = 1;

}

else if (($num_rows % $per_page) == 0) {

 $num_pages = ($num_rows / $per_page);

}

else {

 $num_pages = ($num_rows / $per_page) +1;

}

$num_pages = (int)$num_pages;



if (($page  $num_pages) || ($page  0)) {

 error(You have specified an invalid page
number);

}

$query = $query .  LIMIT $page_start, $per_page;

$result = mysql_query($query,$connection) or die(Error
in Query2);



echo 

HTMLHEAD

TITLETECH-DE Check Work Orders/TITLE

/HEAD

BODY

P align=left

FORM method=\POST\
ACTION=\$PHP_SELF\  

INPUT type=\submit\ value=\Update Work
Orders\

/p

P align=leftT = Finished by Technician/P

table width=230 border=0

tr

td width=25 align=center bgcolor=\#00\font
face=\Verdana\smallb#/b/small/font/td

td width=25 align=center bgcolor=\#00\font
face=\Verdana\smallbT/b/small/font/td

td width=45 align=left bgcolor=\#00\font
face=\Verdana\smallbReq./b/small/font/td

td width=135 align=left bgcolor=\#00\font
face=\Verdana\smallbSituation/b/small/font/td

/tr;

while ($row = mysql_fetch_array($result)) {

 $WONumber = $row[WONumber];

 $Completed = $row[Completed];

 $Requestedby = $row[Requestedby];

 $Situation = $row[Situation];

 $Shortsit = substr($Situation, 0, 25);

 if ($color==#CC) {

 $color=#00;

 } else {

 $color = #CC;

 }

 echo trtd width=25 bgcolor=\$color\center

 a
href="\viewwo.php?WONumber=$WONumber\$WONumber/a/center/td

 td width=25 bgcolor=\$color\centersmall

 font face=\Verdana\input
type=\checkbox\ name=\Checkbox[]\ Value=$WONumber/font/small/center/td

 td width=25 bgcolor=\$color\centersmall

 font face=\Verdana\$Requestedby/font/small/center/td

 td width=110 bgcolor=\$color\centersmall

 font face=\Verdana\$Shortsit/font/small/center/td/tr;

 }

echo /tabletable width=230
border=0tr;

if ($prev_page) {

echo td width=30a href="\$PHP_SELF?page=$prev_page\Prev/a"
/td;

}

else {

echo td width=30nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/td;

}



echo td width=160 align=center;

for ($i = 1; $i = $num_pages; $i++) {

if ($i != $page ) {

 echo  a href="\$PHP_SELF?page=$i\$i/a"
;

} else {

 echo  $i ;

 }

}

echo /td;



if ($page != $num_pages) {

 echo td width=30 align=righta href="\$PHP_SELF?page=$next_page\Next/a;"


}

else {

echo td width=30/td;

}

echo /tr/table;

mysql_free_result($result);

mysql_close($connection);

echo /form

/body

/html;

}

else {

// initialize database connection

print $WONumber;

$connection = mysql_connect(localhost) or

die(Couldn't connect to the database!);

// select database

mysql_select_db(techsupport, $connection);

//formulate and run query

$query = update techsupport set TCompleted='Y'where $WONumber=$Checkbox[0];

$result = mysql_query($query,$connection) or die(Error
in Query2);

}





?



Frank Miller

Computer Specialist and Webmaster

Texas AM University-Texarkana

2600 N. Robison Rd

Texarkana, Texas 75501



Office 165

Phone (903)223-3156

Fax (903)223-3139










smime.p7s
Description: application/pkcs7-signature