i want to send a variable to xxx.php how i do it???
GET request would be
xxx.php?variable=something
and accessing $_GET['variable'] in php side would work.
you can send the variable using $_POST or using $_SESSION to pass value of variable from one file to another
You can send the variable by using the GET method as:
http://www.example.com/welcome.php?fname=Peter
and access it from script as: $_GET["fname"]
- Pass it as a command line argument
- Set it in another PHP file and then include it
- Put it in the query string then access it from
$_GETor$_REQUEST - Put it in the POST data then access it from
$_POSTor$_REQUEST - Put it in a cookie then access it from
$_COOKIES - Put it in a session variable then access it from
$_SESSION
use query string in your code.
For example
$a = "myval" ;
< a href="xxx.php?var=$a" >
Get values by usnig $_GET['var'] , This would give you the query string value.
It's best you read up the basic about POST and GET first.
Here's a simple tutorial to get you started: http://www.tizag.com/phpT/postget.php
Via the URL
for example
www.yoursite.com/xxx.php**?**myVar1=myValue1&myVar2=myValue2
seperate vars by &
or you can do it using a form , via Get
<form method='get'>
Step2:
in your PHP document
$_GET['myVar1']
$_GET['myVar2']