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 3 3047
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_global s turned
on in which case:
$someVar would be set to 20
....but I'd try not to use that anymore
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_global s 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?someV ar=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=a rchives), 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
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_global s 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?someV ar=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=a rchives), 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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 contains:
<?php
$_SESSION = "";
$_SESSION = "";
|
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:
----------------------------------------------------------------------------
<?php
ini_set("session.use_cookies", "off");
ini_set("session.use_trans_sid", "on");
session_start();
$_SESSION = "";
$_SESSION = "";
echo "<form method='POST' action='login.php'>
|
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 of information,
from where I offer a link users can click on.
Let's say I have collected several strings and I have put these in an array
and serialized that.
$var='John Doe';
|
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 user clicks on the image, it
will recenter on that spot (X,Y). I can get things working with either
the nav buttons or ismap but not both due to fact that I need to pass 3
additional name/value pairs (xc,yc,z_num) to the calling script. This
is...
|
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 window and call the form. In this particular instance, a city name is what I have to pass to the form Chapter.htm.
<html>
<head>
| |
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 code but it seems to indicate that you are
actually changing the global vars before executing the DTS. I am interested
in creating a DTS step consisting of a C# console program.
All I want to do is to be able to access the current (running)...
|
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 program.
is this a valid concern? i'm thinking i can check the submitting page
setting up something around the following the following code...
$base_name = basename($_SERVER);
|
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 variables value needs to
be passed from the main page to this popup window ... but it isn't. why?
the submit button one the PHP page is
|
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:
http://www.torusdesign.nl/spry/test.php?folder=schilderijen/vrij_werk&navColor=SchilderijenNAV
This is the code:
<?php echo $folder; ?>
<?php echo $navColor; ?>
|
by: johnjsforum |
last post by:
Buddies,
I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function
//////////////////////////////////////////////////////////////////////////////////// version 1 : using global variables //////////////////////////////////////////////////////////////////
var _textField, _divColorPicker; // global vars
window.onload = function()
{
_textField = document.getElementById('htxaMessage'); // fill...
|
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: 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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: 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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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: 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...
| |