FW: [PHP] PHP_SELF Undefined

From: Date: Mon, 18 Feb 2002 23:14:20 +0000
Subject: FW: [PHP] PHP_SELF Undefined
Groups: php.general 
Request: Send a blank email to php-general+get-85306@lists.php.net to get a copy of this message
You probably do not have register globals set to on, this is often times set to off for security purposes. Instead you can use $_GET, $_POST, $SERVEr, etc, these are documented on the PHP website. Also instead of echoing all that HTML from PHP you should consider jumping out of PHP and then use PHP just to echo your variable. Example: <?php //php code goes here ?> <HTML> <HEAD> <TITLE>Feedback</TITLE> </HEAD> <BODY> <FORM method="POST" action="<?php echo $SERVER['PHP_SELF']; ?>"> <P>Your Name:<br> <INPUT type="text" name="sender_name" size=30></p> <P>Your E-Mail Address:<br> <INPUT type="text" name="sender_email" size=30></p> <P>Your Message:<br> <textarea name="message" cols=30 rows=5></textarea> </p> <P><INPUT type="submit" value="Send This Form"></p> </FORM> </BODY> </HTML> <?php // rest of php code here -----Original Message----- From: Narvaez, Teresa [mailto:Teresa.Narvaez@DynCorp.com] Sent: Monday, February 18, 2002 3:51 PM To: Php-General@Lists.Php.Net Subject: [PHP] PHP_SELF Undefined When I execute the code below, why is PHP_SELF undefined? I will appretiate any help on this. I can get its value by: echo $_SERVER["PHP_SELF"]; Thanks in advance! -Teresa <HTML> <HEAD> <TITLE>Feedback</TITLE> </HEAD> <BODY> <? $form_block = " <FORM method=\"POST\" action=\"$PHP_SELF\"> <P>Your Name:<br> <INPUT type=\"text\" name=\"sender_name\" size=30></p> <P>Your E-Mail Address:<br> <INPUT type=\"text\" name=\"sender_email\" size=30></p> <P>Your Message:<br> <textarea name=\"message\" cols=30 rows=5></textarea> </p> <P><INPUT type=\"submit\" value=\"Send This Form\"></p> </FORM> "; ?> </BODY> </HTML>

« previous php.general (#85306) next »