Closed Thread Icon

Topic awaiting preservation: forms, sessions and videotape Pages that link to <a href="https://ozoneasylum.com/backlink?for=12185" title="Pages that link to Topic awaiting preservation: forms, sessions and videotape" rel="nofollow" >Topic awaiting preservation: forms, sessions and videotape\

 
Author Thread
Red Ninja
Bipolar (III) Inmate

From: Detroit, MI US
Insane since: Mar 2001

posted posted 04-17-2002 16:27

I've been trying to do things the hard way just for the sake of doing it. Rather than using the hidden attribute to retain data across multiple form pages, I've been trying to use sessions.

For some reason, I can't get the session to register the variable name as the name in the form.
For example:
<input name="monkey" ... >
session_start();
session_register("monkey");

Monkey will not be recognized. Yet when I write in the same document:

$monkey = "lovin";
<input name="monkey" ... >
session_start();
session_register("monkey");

it, of course, will retain the value "lovin" in spite of the input field that should be changing the variable.
That says to me that the form is not able to make the name of the input field into a variable. Yet, how does it recognize it as a variable when I perform the function in the regular manner, i.e. one document, submitted to a php file for processing?

I've checked the usual suspects... I don't have any ;s or "s missing. I have even have it written where it is a PHP form that is writing the html page for the forms. I am using all of my dollar signs. Please clue me in on this as I have read a few tutorials and they have not mentioned any difference in the standard operation for sessions when used with forms.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 04-17-2002 16:35

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Red Ninja
Bipolar (III) Inmate

From: Detroit, MI US
Insane since: Mar 2001

posted posted 04-19-2002 06:31

I thought I understood what you were saying, but it is not working. I took out the session_start, I moved the session_registers to the beginning of the document. I took the session register functions out of the document. I've tried just about every combination I can think of.
Maybe we can chalk this one up to my lack of expertise in the field of php, but hey, this is training. Do you think that maybe you could expound on this topic? Your help is SINCERELY appreciated as I have exhausted my resources.


OlssonE
Maniac (V) Inmate

From:  Eagleshieldsbay, Sweden
Insane since: Nov 2001

posted posted 04-19-2002 08:06

Shouldn't it be:

<input name="monkey" ... >
session_start();
session_register("$monkey");

Red Ninja
Bipolar (III) Inmate

From: Detroit, MI US
Insane since: Mar 2001

posted posted 04-19-2002 08:58

Believe it or not, I have already tried that. I get a return on the page that says--

Warning: Cannot send session cookie - headers already sent by (output started at /home/netninja/public_html/formstest/form1.php:6) in [the line that starts the session registering which happens to be 71, unless the session_start is in place. In that case, it refers to that line].

Why can't variables from forms be passed using sessions? Or is it normally a simple operation that I am just botching? Please advise.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 04-19-2002 11:40

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Red Ninja
Bipolar (III) Inmate

From: Detroit, MI US
Insane since: Mar 2001

posted posted 04-19-2002 15:16

tru dat. I'll giver 'er another go.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 04-19-2002 19:14

well, actually the error messages means that you sent any text before calling session_start()...
even a print(' '); would be too much... or an empty line at the begining of a file being included, before the <?php...

Red Ninja
Bipolar (III) Inmate

From: Detroit, MI US
Insane since: Mar 2001

posted posted 04-19-2002 22:24

I found the problem. This is for the information of anyone who cares. It is NOT in any of the online forms that I have read, therefore it is not an obvious solution. Here is why: when you register a variable, outside of using a form, say
session_start();
$monkey="feces";
session_register("monkey");

It will retain the value of the variable across ALL of the web pages.
I had tried EVERY combination... save having the variables from the PREVIOUS page RE-registered on the next page of the multi page form. I did not think this was necessary, as my test with the other form of the variable registering told me that it was automatically passed. So, what I am saying is that with forms, for some reason, you have to register the previous pages variables every time. I don't know WHY it's different, it just is. Wouldn't have found the solution if it wasn't for InI. Thanks for the help from all of you.

I'd like to thank the Academy... I'll shut up now.

« BackwardsOnwards »

Show Forum Drop Down Menu