stublackett Posted September 11, 2008 Share Posted September 11, 2008 Hi, I've got a form that Edits details via a form When the form is submitted the browser is showing "Page Cannot Be Found" and the error is appearing in the URL for the page The error reads admin/%3Cbr%20/%3E%3Cb%3ENotice%3C/b%3E:%20%20Undefined%20variable:%20PHP_SELF%20in%20%3Cb%3EE:/editdirectoryitem.php%3C/b%3E%20on%20line%20%3Cb%3E164%3C/b%3E%3Cbr%20/%3E Not quite sure what pieces of code may be required to decypher this... But the form submit bit is here: <form method="post" enctype="multipart/form-data" action="<?php echo $PHP_SELF ; ?>" > Link to comment https://forums.phpfreaks.com/topic/123766-solved-undefined-variable-php_self/ Share on other sites More sharing options...
pocobueno1388 Posted September 11, 2008 Share Posted September 11, 2008 Try using $_SERVER['PHP_SELF']. If that doesn't work, try manually putting the URL in for the action just to see if it works. Link to comment https://forums.phpfreaks.com/topic/123766-solved-undefined-variable-php_self/#findComment-639052 Share on other sites More sharing options...
stublackett Posted September 11, 2008 Author Share Posted September 11, 2008 Try using $_SERVER['PHP_SELF']. If that doesn't work, try manually putting the URL in for the action just to see if it works. Excellent....... Cheers, I had considered that but didnt use it for whatever reason Why would the form work initially with the <?php echo $PHP_SELF ; ?> then stop working ??? Is that down to Versions been upgraded in PHP or something totally different? Link to comment https://forums.phpfreaks.com/topic/123766-solved-undefined-variable-php_self/#findComment-639057 Share on other sites More sharing options...
DeanWhitehouse Posted September 11, 2008 Share Posted September 11, 2008 Nope, because $PHP_SELF; is not there, so the source code will be <form method="post" enctype="multipart/form-data" action="" > or , if error_reporting is on, <form method="post" enctype="multipart/form-data" action="Something like, Warning Undefiened Variable $PHP_SELF." > Link to comment https://forums.phpfreaks.com/topic/123766-solved-undefined-variable-php_self/#findComment-639059 Share on other sites More sharing options...
pocobueno1388 Posted September 11, 2008 Share Posted September 11, 2008 If you use $_SERVER['PHP_SELF'] the source code should be fine. Why would the form work initially with the <?php echo $PHP_SELF ; ?> then stop working Huh Is that down to Versions been upgraded in PHP or something totally different? I think register_globals has to be enabled in order for just $PHP_SELF to work. It's bad practice to use that anyways. Link to comment https://forums.phpfreaks.com/topic/123766-solved-undefined-variable-php_self/#findComment-639071 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.