LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Transmitting data across webpages (HTML and PHP question) (https://www.linuxquestions.org/questions/programming-9/transmitting-data-across-webpages-html-and-php-question-833034/)

resetreset 09-18-2010 09:37 AM

Transmitting data across webpages (HTML and PHP question)
 
Hi,
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:

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

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


Thanks.

Guttorm 09-19-2010 03:24 AM

You can use PHP session variables for this.

http://www.php.net/manual/en/book.session.php

Wim Sturkenboom 09-19-2010 04:42 AM

Haven't we seen this question before?

http://www.linuxquestions.org/questi...-forms-826771/

theNbomr 09-19-2010 12:42 PM

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.


All times are GMT -5. The time now is 02:22 AM.