473,385 Members | 2,274 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.

help passing variables

test.php:

<?php
$d=$_GET['data'];
echo $d;
?>

when i go to
www....com/test.php?data=1
nothing happens.

I have read a few articles on passing variables through the url and i believe this is the right syntax. Anyone see something im doing wrong?

Thanks
Apr 27 '07 #1
5 1510
code green
1,726 Expert 1GB
Syntax look OK. 'Nothing happens' is not much help. Do you go to the page you expect
Apr 28 '07 #2
devsusen
136 100+
Hi,

it should show 1 in the page. If u like to do something else u need to write the code instead of writting echo $d;
test.php:

<?php
$d=$_GET['data'];
echo $d;
?>

when i go to
www....com/test.php?data=1
nothing happens.

I have read a few articles on passing variables through the url and i believe this is the right syntax. Anyone see something im doing wrong?

Thanks
susen
Apr 28 '07 #3
thats the problem, it does not show 1

if i change the code to:
$d = $_GET['data'];
echo ("hi" . $d); and go to www...com/test.php?$data=1; it prints:

Hi

However if i change
$d = $_GET['data'];
to
$d = 1;

Then it will print
Hi 1, like expected
Apr 28 '07 #4
code green
1,726 Expert 1GB
Your posted code is inconsistent! Your first post named the url variable data
Expand|Select|Wrap|Line Numbers
  1. data.www....com/test.php?data=1 
In the second you name it $data
Expand|Select|Wrap|Line Numbers
  1. www...com/test.php?$data=1;
The dollar should not be there
Apr 30 '07 #5
devsusen
136 100+
Hi,

the url should be www....com/test.php?data=1 not the 2nd one. Try $_REQUEST['data']. But I still don't found any problem with ur code.

susen
Apr 30 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jason Us | last post by:
Does anyone have experience with passing variables from an ASP page to a JSP page. The way it currently works in passing the SSN in the URL. This cannot be good. I thought that storing a...
4
by: A Web Master | last post by:
I want to know the best way of passing on variable contents on a site coded in ASP using frameset/frame. Content is used in all frames for stuffs like screen_resolution, language, ... My...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
10
by: Bob Bedford | last post by:
In the attempt to keep the URL and code quite clean, and avoid to have a very loooong url, we have used $_session for storing values trough the pages. Now, we have some clients that doesn't get...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
4
by: DOTNET | last post by:
Hi, Anybody help me regarding this error: I am assigning the values to the session variables when the button is clicked and passing these session variables to the next page and when I am...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
5
by: CharlesA | last post by:
Hi folks, I'm having a discussion with my colleague about how to go about passing data from one aspx page to another example On the main page I have a whole list of relationship managers with a...
12
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
9
by: quyvle | last post by:
I can't seem to get this function to work correctly. I'm wondering if anyone could help me out with this. So I'm using the fscanf function to read the input stream and store each string in the...
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: 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: 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.