Forum Moderators: coopster

Message Too Old, No Replies

need to set a session variable equal to a parameter passed in url

creating session variable and make it equal to url parameter

         

bonsai808

11:32 pm on Feb 9, 2005 (gmt 0)



Hi everyone. I am an ASP and ASP.net programmer and venturing into PHP for my first time today. I am currently working on a PHP site that and I need to do the following:

- Receive a URL parameter (a username) from another site
- Create a session variable and make it equal to the URL parameter
- write the session variable to the screen

I know this is must be extremely easy, but I do not understand PHP at all. Thanks in advance for your help!

Timotheos

12:08 am on Feb 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey bonsai,

Welcome to WebmasterWorld and welcome to PHP!

Funny I just bookmarked this sity yesterday that compares PHP, ASP and JScript [phplens.com]. It's a nice little reference for these kind of things.

Otherwise check out the PHP manual [php.net] and the Library [webmasterworld.com].

Tim

dmmh

5:10 am on Feb 10, 2005 (gmt 0)

10+ Year Member



depending on the external url....dont know how you go from 1 site to the other....this might give you an idea

/*first check if a request has been made, get its value, run it through mysql_real_escape_string() for added security if you may also need it in queries etc, assign it to a var and create a session variable*/
<? if(!empty($_GET['name'])){
$external_username = mysql_real_escape_string($_GET['name']);
$_SESSION['external_username'] = $external_username;
echo $_SESSION['external_username'];
}