Jump to content

pass variable through link


Jenling

Recommended Posts

Hello to all expert!I want to ask how to pass my variable to the next page by a link?How it works?Can someone help me? For example, I want to pass the value of id, day, month, year and start_time, end_time to another page, what can I do with this??? ???

Link to comment
Share on other sites

Hi,

 

The easiest way as terms of execution is passing it directly in the url of the page you are calling for example

 

www.yourdomain.com/mypage.php?id=1&day=01&month=02&year=08

 

In mypage.php you can access the vars using the $_GET superglobal for example:

 

if (isset($_GET['id')) 
{
   $id = $_GET['id']
   $date = $_GET['date']
   //etc...
}

 

There is a security draw back in passing vars via the url but if you google $_GET and security there are some good tuts on how to sanitise your passed data!

 

HTH

 

Dave

 

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.