Hi,
Is it wrong to forcefully set a value HTTP_GET_VARS and HTTP_POST_VARS
$HTTP_GET_VARS['foo'] = 'bar'?
If yes, why? and how can i pass value between one page and the other without
using the url?
Regards,
Sims 4 4352
> Is it wrong to forcefully set a value HTTP_GET_VARS and HTTP_POST_VARS $HTTP_GET_VARS['foo'] = 'bar'? If yes, why? and how can i pass value between one page and the other without using the url?
Feel free to do that if you wish. It will only exist until the end of
this script though.
To pass variables between scripts you can do one of the following:
1. Add them to the URL and pick from $HTTP_GET_VARS (now $_GET)
2. Add them to a form and pick from $HTTP_POST_VARS (now $_POST)
3. add them to $_SESSION[] which is probably the recommended way. Is it wrong to forcefully set a value HTTP_GET_VARS and HTTP_POST_VARS
$HTTP_GET_VARS['foo'] = 'bar'? If yes, why? and how can i pass value between one page and the other
without using the url? Feel free to do that if you wish. It will only exist until the end of this script though.
Yes sorry that is what i should have said.
if( !$HTTP_GET_VARS['foo'] ){
$HTTP_GET_VARS['foo'] = 'bar';
}
....
it would make it easier for me to assume that $HTTP_GET_VARS['foo'] exists
by forcefully setting it at the beginning of the script.
There are many ways of doing it like
$myscritval['foo'] = isset(
$_GET['foo'])?$_GET['foo']:(isset($_POST['foo'])?$_POST['foo']:'bar';
I was curious about the value of $HTTP_GET_VARS if it was bad practice to
set that value. To pass variables between scripts you can do one of the following: 1. Add them to the URL and pick from $HTTP_GET_VARS (now $_GET) 2. Add them to a form and pick from $HTTP_POST_VARS (now $_POST)
What is the minimum php version for $_GET and $POST? I was told to use the
old version as it will not hurt my script, ( as long as i have global
$HTTP_GET_VARS; in my functions).
3. add them to $_SESSION[] which is probably the recommended way.
Yes of course, that is another way. But i keep been told that there are
times where the user can set his browser to make sessions useless.
But i have never really looked into it really.
Sims
Sims wrote: Is it wrong to forcefully set a value HTTP_GET_VARS and HTTP_POST_VARS
Feel free to do that if you wish. It will only exist until the end of this script though.
Yes sorry that is what i should have said. if( !$HTTP_GET_VARS['foo'] ){ $HTTP_GET_VARS['foo'] = 'bar'; } ...
it would make it easier for me to assume that $HTTP_GET_VARS['foo'] exists by forcefully setting it at the beginning of the script.
Absolutely fine. That's probably good practice, while you're at it you
should check that the sent value is reasonable.
What is the minimum php version for $_GET and $POST? I was told to use the old version as it will not hurt my script, ( as long as i have global $HTTP_GET_VARS; in my functions).
4.1.0 - you'll need to watch out though as later releases of php will do
away with the old variables.
3. add them to $_SESSION[] which is probably the recommended way.
Yes of course, that is another way. But i keep been told that there are times where the user can set his browser to make sessions useless. But i have never really looked into it really.
Sessions are really aimed towards using cookies. If cookie support is
turned off then they don't work properly. There is a php.ini setting to
transparently test if cookies are available and default to modifying all
links to add the session id. It doesn't look pretty if cookies are off
though.
"Kevin Thorpe" <ke***@pricetra k.com> schrieb im Newsbeitrag
news:40******** **************@ news.easynet.co .uk... Sims wrote:
Is it wrong to forcefully set a value HTTP_GET_VARS and HTTP_POST_VARSFeel free to do that if you wish. It will only exist until the end of this script though.
Yes sorry that is what i should have said. if( !$HTTP_GET_VARS['foo'] ){ $HTTP_GET_VARS['foo'] = 'bar'; } ...
it would make it easier for me to assume that $HTTP_GET_VARS['foo']
exists by forcefully setting it at the beginning of the script.
Absolutely fine. That's probably good practice, while you're at it you should check that the sent value is reasonable.
It seems wrong to me to create a variable that looks like a get variable but
is none. Why not:
if(isset($_GET['foo'])) {
$foo = $_GET['foo'];
}
else {
$foo = "bar";
}
If you extract all your request variables like that before processing them
you have a transparent code. (If $foo can be transmitted with either get or
post, just check for $_REQUEST['foo']). Also it is easier to write $foo than
$_GET['foo'] or even $HTTP_GET_VARS['foo'] all the time.
Imagine your script is 400 lines long, and anywhere your above code appears.
In 2 years you have to make a modification, it will take you an hour to
figure out why there is a value for a field that you did not submit!
HTH
Markus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ben Hall |
last post by:
Hey guys,
I'm building a web application in php for the first time (I like php a
lot..) and have come across a litle stumbling block.
I want to access a passed url parameter with $HTTP_GET_VARS in a class, but
I can't get it to work.
Note the following php page, which creates an object that pulls the "param"
parameter in both the class and globally. The global one works, the one in
|
by: Phrylock |
last post by:
I am a beggining PHP developer (been doing it for like 3 weeks now)
and I am currently having a problem getting these arrays to work. I am
running PHP 4.3.4 with Apache 2.0.47 on WinXP. I have a pretty good
idea as to how they work, but no clue on how to apply them to the PHP
scripts that I have written. (I'm not sure how to code it in properly,
and have been stuck on this problem for a few days now) Could some one
please advise me on this...
|
by: John Pastrovick |
last post by:
I am new to PHP, coming from ASP coding
if (HTTP_GET_VARS==1){
print "Yes";
}else{
print "No";
}
when "b" is not passed via
(http://www.mydomain.com?b=1
|
by: Chris Cox |
last post by:
Hi,
Hoping someone can help, I have a sql query which is passed to the
script via the url, this is like:-
&stmt=select%20*%20from%20table%20where%20(%20status!='Closed'%20.....
If I look at $_GET, this gives:-
select * from tickets where ( status=''Closed'' ......
If I look at $HTTP_GET_VARS, this gives:-
|
by: Niyazi |
last post by:
Hi,
We have and IBM AS400 and I belive the reional setting is Turkish. The IBM
Client-Access for Windows that install in our PC (WIN XP SP2) set to Turkish
characters.
Now my PC has English (US) regional setting and I am not having any problem
to connect.
But If I change my PC Regional setting to Turkish all of my VB.NET code is
| |
by: Dixie |
last post by:
Can I set the Format property in a date/time field in code?
Can I set the Input Mask in a date/time field in code?
Can I set the Format of a Yes/No field to Checkbox in code?
I am working on a remote update of tables and fields and can't find enough
information on these things.
Also, how do you index a field in code?
|
by: Shravan |
last post by:
Hi,
I have a Windows Forms Custom DataGrid, which is put in a
usercontrol, which on setting DataSource is setting focus
to grid. The call stack for setting the focus is as
follows. This is not happened always whenever DataSource
is set, only called sometimes, in a series of setting
DataSource, I could get this setting focus only one time .
Can anybody help me how to stop this one.
system.windows.forms.dll!
|
by: junlia |
last post by:
Hi All,
I am working on a project that acts as a bridge. It does some checking with
post xml data, and then redirects the request to an appropriate page.
However, we find that depends on the browser cache setting (and OS), the
program behaves differently.
This is how it should work:
1. The client program opens a webbrowser control, using navigate2 method to
post xml data to my aspx pages, eg abc.aspx
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |