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

passing Vars?

Hows does the passing variables from page to page work?

Specifically, when you type in a URL like:
http://www.someurl.com/test.php?someVar=20

How does the next page get, and use the variable?

Sorry for the dumb question..

Thanks

-Richard
Jul 17 '05 #1
3 3035
Richard Ragon wrote:
Hows does the passing variables from page to page work?

Specifically, when you type in a URL like:
http://www.someurl.com/test.php?someVar=20

How does the next page get, and use the variable?


$_GET['someVar'] would be set to 20
$_POST[] holds values from a POSTed form
both are merged together in $_REQUEST[]

.....unless you have an old version of php with register_globals turned
on in which case:
$someVar would be set to 20
....but I'd try not to use that anymore


Jul 17 '05 #2
Kevin Thorpe wrote:
Richard Ragon wrote:
Hows does the passing variables from page to page work?

Specifically, when you type in a URL like:
http://www.someurl.com/test.php?someVar=20

How does the next page get, and use the variable?


$_GET['someVar'] would be set to 20
$_POST[] holds values from a POSTed form
both are merged together in $_REQUEST[]

....unless you have an old version of php with register_globals turned
on in which case:
$someVar would be set to 20
...but I'd try not to use that anymore


Also, remember that GET, aka the way you have it (test.php?someVar=blah),
isn't the best way of doing things all the time. I find it great for
specifying the page you want to be on (ie: news.php?page=archives), and
this is how it should be used, but if you are working with form data, I
would suggest always using the POST method, as it 1. can handle more data,
and 2. hides the data from the user and makes it harder to spoof.
-Eric Kincl
Jul 17 '05 #3
Eric Kincl wrote:
Kevin Thorpe wrote:

Richard Ragon wrote:

Hows does the passing variables from page to page work?

Specifically, when you type in a URL like:
http://www.someurl.com/test.php?someVar=20

How does the next page get, and use the variable?


$_GET['someVar'] would be set to 20
$_POST[] holds values from a POSTed form
both are merged together in $_REQUEST[]

....unless you have an old version of php with register_globals turned
on in which case:
$someVar would be set to 20
...but I'd try not to use that anymore

Also, remember that GET, aka the way you have it (test.php?someVar=blah),
isn't the best way of doing things all the time. I find it great for
specifying the page you want to be on (ie: news.php?page=archives), and
this is how it should be used, but if you are working with form data, I
would suggest always using the POST method, as it 1. can handle more data,
and 2. hides the data from the user and makes it harder to spoof.


Basically use GET for navigation and things without side effects.
Anything which will write to your database should use POST.

Imagine a page listing every record in your database with a 'delete'
link next to it. Along comes Googlebot to index your site and merrily
deletes every record you had. Bots do not (to my knowledge) ever use POST.

Jul 17 '05 #4

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

Similar topics

5
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page...
1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
3
by: Pjotr Wedersteers | last post by:
Hello again, I have now several consecutive forms in my site which nicely pass variables in POST, so they won't show up in the header. Now I have a page people reach after submitting all kinds...
4
by: mpm3 | last post by:
Greetings, I'm trying to write a mapping app that the user can click on some nav buttons (Up, Down, Lf, Rt, Zooom, etc) to pan/zoom the image but also include 'ismap' such that where ever the...
5
by: Jim Banks | last post by:
Greetings I'm opening a pop up window with a html form, (in one document) and I want to pass a variable to the html form called from the hyperlink. Here's the code I'm using to pop up the...
0
by: Count Darling | last post by:
(note: this is a cross-post from the sqlserver.dts group as I've gotten no help there) What is the simplest way to get and set the DTS global variables from a C# program? I have seen some sample...
28
by: Skeets | last post by:
i'm passing session and hidden variables between pages. not to mention post values. i'm a little concerned that someone with sufficient knowledge could spoof these vlaues and manipulate the...
5
by: Steve | last post by:
Hi, I currently have a problem passing a variable value from one page to another. Once a form submit button is pressed java pops up a window and displays some information. The problem being is...
2
by: Bob Bruyn | last post by:
I've recently installed Apache 2 and php 5.2 on my WIndows XP machine. Everything is up and running. I'm passing some vars via the URL. It works fine online:...
1
by: johnjsforum | last post by:
Buddies, I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function ////////////////////////////////////////////////////////////////////////////////////...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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...
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.