Jump to content

Is this a common thing? issue with "<?php echo $PHP_SELF;?>"


xwishmasterx

Recommended Posts

Hello

 

I have a from that updates a few things in the db, and uses "<?php echo $PHP_SELF;?>".

 

The form does update everything fine, however that page does not reflect it. If I refresh the page manually

I can see the new values.

 

Is this a common thing, and can anything be done to fix this?

Link to comment
https://forums.phpfreaks.com/topic/262844-is-this-a-common-thing-issue-with/
Share on other sites

That symptom generally indicates that the order of your logic on the page is backwards. Your code on the page is likely retrieving the data before you are updating/altering the data, so you get the initial data values displayed, not the updated ones.

 

BTW, $PHP_SELF was depreciated and turned off by default 10 years ago, throws a depreciated error when turned on starting in php5.3 (where the depreciated errors were introduced), and has been completely removed in php5.4. You would use $_SERVER['PHP_SELF'] or more simply leave the action='' attribute blank to submit to the same page.

ofcourse, that makes perfect sense...as I update db after retrieving the current values..thanks a bunch.

PS. thanks for letting me know that "$PHP_SELF was depreciated and turned off by default 10 years ago", maybe I should start paying attention to post dates when using tutorials:)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.