Php_self ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
msaf101
Forum Newbie
Posts: 1
Joined: Wed Nov 26, 2003 2:42 pm

Php_self ?

Post by msaf101 »

If my form uses the action $php_self, and the php code is found elsewhere on the page, how does the form know what php code to use? This would be really confusing on pages where I have several independant bits of php code, like if part of the form itself (For an input field label that could change or something) contained php code.

Despite my inexperience I think I've already decided that my forms should call on specific php files rather than code on the same page.
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

It'll execute the code from the top of the page to the bottom.

To use specific code, you could add a hidden form field like:
<input type="hidden" name="action" value="update">

Then have in php an if block to check what "action" you should perform.
Post Reply