passing variables please help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
roby2411
Forum Newbie
Posts: 13
Joined: Tue Sep 12, 2006 9:52 am

passing variables please help

Post 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
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post 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;
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

yep, sounds like a job for php sessions
roby2411
Forum Newbie
Posts: 13
Joined: Tue Sep 12, 2006 9:52 am

Post by roby2411 »

and how if i need to post variable without forms and without submit
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post 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'];

User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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"
Post Reply