Jump to content

Recommended Posts

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

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?

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." >

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.