473,378 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 12513
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_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
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.comwrote:
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"all 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"all 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
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
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...
43
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...
2
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...
1
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...
7
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...
8
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. ...
1
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...
3
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.