Page 1 of 1

passing variables please help

Posted: Fri Sep 15, 2006 7:18 pm
by roby2411
dear all my u tell how pass variables automatically between to pages without using form
i need a function that looks like

Code: Select all

function post_data($value)
{
      post ( "http://www.sitename.com:5050" , $value )
}
what should i do

Posted: Fri Sep 15, 2006 8:13 pm
by neophyte
If you want to post a form with user submission there's CURL functions.

If you just want to store data how about $_SESSION['someVar'] = $variable;

Posted: Fri Sep 15, 2006 8:19 pm
by Luke
yep, sounds like a job for php sessions

Posted: Fri Sep 15, 2006 8:57 pm
by roby2411
and how if i need to post variable without forms and without submit

Posted: Fri Sep 15, 2006 9:27 pm
by neophyte

Code: Select all

//Put this before all HTML.
session_start();
//Then save your post variable to:
$_SESSION['variable'] = $your_variable_to_store;
On the next page.

Code: Select all

echo $_SESSION['variable'];


Posted: Sat Sep 16, 2006 12:24 am
by aaronhall
Passing data without using a form or PHP sessions:

http://www.somesite.com:5050/?var1=value1&var2=value2

In the following page:

$_GET['var1'] would return "value1" and $_GET['var2'] would return "value2"