Jump to content

Passing variable via URL


ainoy31

Recommended Posts

I am passing a variable from one page via the URL and requesting it on another page -> $_REQUEST['id1'];

 

I need to gave this data and then pass it to another page.  Do I use the same method or can I assign the request data to a new variable?  Hope this is not confusing.  Much appreciation.

 

AM

Link to comment
https://forums.phpfreaks.com/topic/57603-passing-variable-via-url/
Share on other sites

you could use $_GET instead of $_REQUEST but thats not too important

 

You should use sessions

 

but the basic idea is you start with session_start(); and then store sessions like this:

 

<?php

session_start();

$_SESSION['id'] = $_RQUEST['id1'];

?>

 

Then on whatever page you use session_start(); you will be able to call the id.

 

 

Thats a helf-arsed explanation, but i think it covers the general idea ;D

 

~ Chocopi

I have say xxx.php?id=$amount on one page.

 

I am requesting that variable on another page by using <? echo $_REQUEST['id'] ?>.  Which works fine.

 

Now, I want to use the same variable onto a third page.  Assigning the request variable to a new variable does not work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.