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
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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.