Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-18-2010, 09:37 AM   #1
Senior Member
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
Transmitting data across webpages (HTML and PHP question)

For a page I'm making, there'll be a "make a friend" link, upon clicking which, the user will be taken to a login page, so that they can authenticate themselves (i.e. WHO wants to make a friend). I want the link to be processed by a "makefriendlogin.php" script which will have "person" as an argument, ie. makefriendlogin.php?person=26 (the number comes from a database, don't worry about it). My question is, how do I write the makefriendlogin.php script, so that the "author" argument will be available to the "makefriend.php" script that'll actually do the authenticating for the user when they enter their name and password?

I thought of something like this:

<form method="post" action="makefriend.php">
<input name="username" type="text">
<input name="password" type="password">
$author=$_POST['author'] ;
<input name="author" type="hidden" value="$author">
<input type="submit" value="submit">

But I'm getting confused about it all. Am I doing it correct?

Old 09-19-2010, 03:24 AM   #2
Senior Member
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,346

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
You can use PHP session variables for this.
Old 09-19-2010, 04:42 AM   #3
Wim Sturkenboom
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Haven't we seen this question before?
Old 09-19-2010, 12:42 PM   #4
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The concept works like this: a single token is placed into a cookie or hidden field of all pages in the application. The (unique) value of the token is an index/key to the full complement of session-specific data, and is use on the server as a way to locate all of the session-specific data on the server (in, for instance, a relational database).
The method of encoding the session key is implementation-specific. PHP Sessions is an example of such use of data persistence. You are free to contrive your own methods.

What part of the picture is still missing?

--- rod.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML form data in PHP without postback? linuxlover.chaitanya Programming 18 02-11-2010 11:10 PM
Optical interconnects for transmitting data within the PC jibey.jacob General 2 07-04-2009 01:05 PM
HTML, PHP, forms, submitting data Problem Silent1 Programming 3 08-31-2004 03:03 PM
transmitting data to a PC Stephanie General 3 04-05-2002 03:29 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration