RE: [PHP] Making PHP_SELF in PHP4 work is driving me nuts. (Newbie)

From: Date: Thu, 09 Nov 2000 22:14:49 +0000
Subject: RE: [PHP] Making PHP_SELF in PHP4 work is driving me nuts. (Newbie)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24572@lists.php.net to get a copy of this message
try: $HTTP_SERVER_VARS['PHP_SELF'] -- Rich Cavanaugh -----Original Message----- From: Peter Constantinidis [mailto:PConstantinidis@grocerygateway.com] Sent: Thursday, November 09, 2000 4:50 PM To: php-general@lists.php.net Subject: [PHP] Making PHP_SELF in PHP4 work is driving me nuts. (Newbie) I understand that if I turn register globals on, this automatically works but since this is depreciated I should learn the php4 way of doing things.. Here is the code fragment that works if register globals is on.. I've been trying various stuff like: $PHP_SELF=HTTP_ENV_VARS["PHP_SELF"]; and printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $HTTP_ENV_VARS["PHP_SELF"], $myrow["id"], $myrow["first"], $myrow["last"]); but neither works.. aaaaaaaaaaaaa!!! <head combusts> <?php $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); // display individual record if ($id) { $result = mysql_query("SELECT * FROM employees WHERE id=$id",$db); $myrow = mysql_fetch_array($result); printf("First name: %s\n<br>", $myrow["first"]); printf("Last name: %s\n<br>", $myrow["last"]); printf("Address: %s\n<br>", $myrow["address"]); printf("Position: %s\n<br>", $myrow["position"]); } else { // show employee list $result = mysql_query("SELECT * FROM employees",$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF, $myrow["id"], $myrow["first"], $myrow["last"]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo "Sorry, no records were found!"; } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#24572) next »