473,385 Members | 1,907 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,385 software developers and data experts.

Multiple submits broken in PHP5

I have a page with multiple submit buttons. Call them "ok" and
"cancel". I have the coding in PHP as:

if (isset($ok)) { something } and if (isset($cancel)) { something
else }

This works fine in PHP 4.X. In PHP5 it doesn't work at all (no action
at all). What is the replacement coding and how can I code so that it
works in all versions of PHP?

Shelly

Jul 17 '05 #1
2 1374
On 26 May 2005 04:51:49 -0700, sh*******@asap-consult.com wrote:
I have a page with multiple submit buttons. Call them "ok" and
"cancel". I have the coding in PHP as:
if (isset($ok)) { something } and if (isset($cancel)) { something
else }


Oh man. http://php.net/manual/en/security.globals.php
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Jul 17 '05 #2
It should be noted that this is not an issue of PHP 4 versus 5, but rather
of different configurations (php.ini files).

You are able to access $ok and $cancel because they are automatically set as
global variables in your PHP 4 config. You should disable this - only
goodwill can stop me from submitting a form with a field called "query" set
to drop all your databases...

To do so, open your php.ini file (probably located in your PHP folder or
your Windows folder - on Windows) and change the line that reads:

register_globals = On

to

register_globals = Off

Now, you not be able to access $ok or $cancel directly - instead, you can
access them through the $_GET or $_POST arrays(depending on your form
method). For example, if your form method is POST, then you can use this:

if (isset($_POST["ok"])) { something } and if (isset($_POST["$cancel"]))
{ something else }

ECRIA
http://www.ecria.com
Jul 17 '05 #3

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

Similar topics

5
by: Marc | last post by:
Hello, I have a self - submitting form with multiple submits and I want to detect after the submit which button is pressed. Code example: <form name="example" method="post"...
2
by: David Pautler | last post by:
I'm creating a web-based authoring tool where one form encompasses several sections for editing. I'd like each section to have its own reset button, so that use of that button affects only that...
10
by: Rich Kucera | last post by:
Holding all versions at 5.0.4, Multiple stacks with multiple-version configurations inevitable Will have to wait to see what the impact of problems such as http://bugs.php.net/bug.php?id=33643 ...
4
by: Hul Tytus | last post by:
comp.infosystems.www.authoring.html multiple submits When multiple submit lines are placed in an HTML form, the string returned to the server shows the name=value field for each one with no...
6
by: RobR | last post by:
We have a customer using our application that has a problem. Within our app, we have a two different forms (one generates an email, the other a fax via a webservice). When they click the submit...
2
by: Philipp Lenssen | last post by:
I have WAMP (PHP5/ Apache runnng on WinXP). I'm accessing the Google and Yahoo APIs but this is usually very slow. How can I run multiple processes at the same time? Is there some multi-threading...
0
by: uninvitedm | last post by:
I'm making a JSP page where (ideally) you select files to upload, each selected file is added to a listbox. The form is submit, (along with some other parameters), and the files are uploaded. They...
13
by: Samir Chouaieb | last post by:
Hello, I am trying to find a solution to a login mechanism for different domains on different servers with PHP5. I have one main domain with the user data and several other domains that need...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.