473,562 Members | 2,975 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Alternatives to $PHPSELF

My boss has saddled me with this task, so I don't know all the
specifics. What I do know, is that I am looking for something similar
to this:

<form action="<? echo $PHPSELF ?>" method="POST">

Syntax aside, I think you can see what we are trying to accomplish. We
want to use PHP to call the exact same page that the form is on, for
processing. I take it that the page with the form will also contain
some PHP code that is executed when the page is reloaded. We want to
be able to reload the page, independent of the page name. So that if
we decide to rename the page foo.php or bar.php, it doesn't matter
because the form reloads its own page by reference, and not by name.

Other than $PHPSELF, $PHP_SELF or $SERVER['PHP_SELF'] (that should
just about cover it), what other options are there? I am looking for
all possible ways to do this. If you want, please just respond with a
keyword or a code snippet. I can research the details. Thank you in
advance.

Feb 20 '07 #1
5 12526
Jerim79 wrote:
My boss has saddled me with this task, so I don't know all the
specifics. What I do know, is that I am looking for something similar
to this:

<form action="<? echo $PHPSELF ?>" method="POST">

Syntax aside, I think you can see what we are trying to accomplish. We
want to use PHP to call the exact same page that the form is on, for
processing. I take it that the page with the form will also contain
some PHP code that is executed when the page is reloaded. We want to
be able to reload the page, independent of the page name. So that if
we decide to rename the page foo.php or bar.php, it doesn't matter
because the form reloads its own page by reference, and not by name.

Other than $PHPSELF, $PHP_SELF or $SERVER['PHP_SELF'] (that should
just about cover it), what other options are there? I am looking for
all possible ways to do this. If you want, please just respond with a
keyword or a code snippet. I can research the details. Thank you in
advance.
Hi Jerim,

Many browsers reload if the href of a hyperlink or the action in a form is
empty. I wouldn't trust that behaviour, however...

But WHY do you not want to use the obvious good solutions you described
yourself?

Sounds to me like: I want to fly to Autralia, and I know I can take a plane,
but what other options do I have?

A baloon? Zeppelin?

Just take the plane.
Just use PHPSELF (any of the above that works).

Regards,
Erwin Moller
Feb 20 '07 #2
On Feb 20, 8:43 am, Erwin Moller
<since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
Jerim79 wrote:
My boss has saddled me with this task, so I don't know all the
specifics. What I do know, is that I am looking for something similar
to this:
<form action="<? echo $PHPSELF ?>" method="POST">
Syntax aside, I think you can see what we are trying to accomplish. We
want to use PHP to call the exact same page that the form is on, for
processing. I take it that the page with the form will also contain
some PHP code that is executed when the page is reloaded. We want to
be able to reload the page, independent of the page name. So that if
we decide to rename the page foo.php or bar.php, it doesn't matter
because the form reloads its own page by reference, and not by name.
Other than $PHPSELF, $PHP_SELF or $SERVER['PHP_SELF'] (that should
just about cover it), what other options are there? I am looking for
all possible ways to do this. If you want, please just respond with a
keyword or a code snippet. I can research the details. Thank you in
advance.

Hi Jerim,

Many browsers reload if the href of a hyperlink or the action in a form is
empty. I wouldn't trust that behaviour, however...

But WHY do you not want to use the obvious good solutions you described
yourself?

Sounds to me like: I want to fly to Autralia, and I know I can take a plane,
but what other options do I have?

A baloon? Zeppelin?

Just take the plane.
Just use PHPSELF (any of the above that works).

Regards,
Erwin Moller
My boss routinely gives me these types of assignments. Since I am
junior in CS, and have been working at this company for less than six
months, I take it that he is trying to give me some "learning"
opportunities. Or perhaps he is just testing me, to see if I have the
ability to come up with the answer.

Feb 20 '07 #3
On 20 Feb, 14:33, "Jerim79" <m...@hotmail.c omwrote:
My boss has saddled me with this task, so I don't know all the
specifics. What I do know, is that I am looking for something similar
to this:

<form action="<? echo $PHPSELF ?>" method="POST">

Syntax aside, I think you can see what we are trying to accomplish. We
want to use PHP to call the exact same page that the form is on, for
processing. I take it that the page with the form will also contain
some PHP code that is executed when the page is reloaded. We want to
be able to reload the page, independent of the page name. So that if
we decide to rename the page foo.php or bar.php, it doesn't matter
because the form reloads its own page by reference, and not by name.

Other than $PHPSELF, $PHP_SELF or $SERVER['PHP_SELF'] (that should
just about cover it), what other options are there? I am looking for
all possible ways to do this. If you want, please just respond with a
keyword or a code snippet. I can research the details. Thank you in
advance.
I would suggest using the full tags as in <?php .... ?>

Feb 20 '07 #4
Jerim79 schreef:
My boss has saddled me with this task, so I don't know all the
specifics. What I do know, is that I am looking for something similar
to this:

<form action="<? echo $PHPSELF ?>" method="POST">

Syntax aside, I think you can see what we are trying to accomplish. We
want to use PHP to call the exact same page that the form is on, for
processing. I take it that the page with the form will also contain
some PHP code that is executed when the page is reloaded. We want to
be able to reload the page, independent of the page name. So that if
we decide to rename the page foo.php or bar.php, it doesn't matter
because the form reloads its own page by reference, and not by name.

Other than $PHPSELF, $PHP_SELF or $SERVER['PHP_SELF'] (that should
just about cover it), what other options are there? I am looking for
all possible ways to do this. If you want, please just respond with a
keyword or a code snippet. I can research the details. Thank you in
advance.
all the variants of $_SERVER['PHP_SELF'] have the flaw that they come
from the user.. And thus are unsafe by definition...

Afaik, if you use <form action="#" method="POST"al l browsers will post
to the same URL that used to request the page. So you get the same
behaviour, without the potential security issue.
--
Tim Van Wassenhove <url:http://www.timvw.be/>
Feb 20 '07 #5
Tim Van Wassenhove wrote:
Jerim79 schreef:
>My boss has saddled me with this task, so I don't know all the
specifics. What I do know, is that I am looking for something similar
to this:

<form action="<? echo $PHPSELF ?>" method="POST">

Syntax aside, I think you can see what we are trying to accomplish. We
want to use PHP to call the exact same page that the form is on, for
processing. I take it that the page with the form will also contain
some PHP code that is executed when the page is reloaded. We want to
be able to reload the page, independent of the page name. So that if
we decide to rename the page foo.php or bar.php, it doesn't matter
because the form reloads its own page by reference, and not by name.

Other than $PHPSELF, $PHP_SELF or $SERVER['PHP_SELF'] (that should
just about cover it), what other options are there? I am looking for
all possible ways to do this. If you want, please just respond with a
keyword or a code snippet. I can research the details. Thank you in
advance.

all the variants of $_SERVER['PHP_SELF'] have the flaw that they come
from the user.. And thus are unsafe by definition...

Afaik, if you use <form action="#" method="POST"al l browsers will post
to the same URL that used to request the page. So you get the same
behaviour, without the potential security issue.

I use action="?". It works for either GET or POSTing.

--
Curtis, http://dyersweb.com
Feb 23 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1467
by: Scott F | last post by:
testvar = bob # Trial A: This does not work if testvar == ("fred" or "bob): statements # Trial B: This does work if textvar == "fred" or textvar == "bob": statements
3
2952
by: Dan Christensen | last post by:
I have written a small application in VB6 -- a kind of special purpose text editor. There seem to be many annoying glitches in VB's rich text box control, however. Performance on larger files has suffered as a result of various work-arounds I have had to use. And there some very annoying, nonstandard "features." Are there any C++ alternatives...
43
4923
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own libraries. I'm not sure if that's a good thing or not. AFAIK, most of Qt is compatable with the Standard Library. That is, QLT can interoperate with...
2
6790
by: Guadala Harry | last post by:
The current implementation (that works) retrieves data from a SS2K db via stored procedure that returns 40-60 rows and 6 columns (one string and five int columns), and places that result set into a DataTable that remains in the Application State (this is an asp.net web application). Various methods throughout the app read this DataTable -...
1
1291
by: Doug | last post by:
Looking for opinions/suggestions: Suppose I have a "region" of an aspx page I want to hide or show based on whatever runtime conditions. Additionally, the entire region is defined by an HTML <TABLE>. There is nothing else in the region beyond whatever is contained in the <TABLE>. I see at least two options for showing/hiding this region....
7
7234
by: Aaron Schnieder | last post by:
Hi, After battling with Crystal Reports for a while I have started to look for alternatives. It seems like there has got to be something out there that does a better job than Crystal Reports because I have run across a lot of issues with it in the short time I have been working with it. I have an ASP .NET database site that will be going...
8
12967
by: werner | last post by:
Hi! I don't want to use eval() in order to parse a user-supplied formula. What alternatives do I have? PHP has no standard functionality for tokenizing or parsing expressions in this regard. Here is a simple example: The user supplies the following formula in string format, "a = (6+10)/4", and the script needs to find out what the value...
1
3095
by: Spencer | last post by:
Our Mainframe DBA insists that the IDTHTOIN parameter be set to 600 so that all idle threads timeout after 10 minutes. This is causing a particular packaged application that expects to hold idle threads open for as long as it wants problems. From an application standpoint there is not an acceptable workaround that would allow the...
3
2662
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I've used an Application_BeginRequest function in my global.asax page to implement some URL rewriting functionality on our website. However, upon moving it to my host (1&1.co.uk), it no longer works. They don't support Application_BeginRequest? They've given me a list of the low-level functions they do support, which can be...
0
7655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7627
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6221
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5477
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3608
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2073
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
903
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.