Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sessions and PHP_SELF

Status
Not open for further replies.

KPIDelivery

Programmer
Apr 19, 2002
1
US
I am trying to use these sessions and php_self form in combination. For some reason the form will not change the variable values. Am I nuts?

Here is the code samples to see if some of you geniuses see what i am doing wrong. They are small and you can copy

//sessionvariables.php script
<?
session_start();
session_register ('apieceofdata');
session_register ('andanother');
require( &quot;sessionvariables3.php&quot; );
$apieceofdata = &quot;this is&quot;;
$andanother =&quot;all the data&quot;;

?>
<form action=&quot;<? echo $PHP_SELF; ?>&quot; method=&quot;POST&quot; ENCTYPE=&quot;multipart/form-data&quot;>
This overrides a piece of data: <input name=&quot;apieceofdata&quot; type=&quot;text&quot;> <br>
This overrides and another: <input name=&quot;andanother&quot; type=&quot;text&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;submit&quot;> </form>
<?
If ($submit )
{
echo $apieceofdata.&quot; &quot;.$andanother.'<br>';
echo &quot;<a href='sessionvariables2.php'>|= ENTER =|</a>&quot;;
}

?>
//end of sessionvariables1.php script


//sessionvariables2.php script
<?
session_start();
echo &quot;What have I got? &quot;.$apieceofdata.&quot; &quot;.$andanother.'<br>';
echo &quot;Plus this? &quot;.$abigdata;
?>
//end of sessionvariables2.php

//sessionvariables3.php script
<?
session_start();
session_register('abigdata'); $abigdata='A Lotta Data';
?>
//end of sessionvariables3.php



I made up this simple example becuase i had built a big multipart form program and variables were not getting passed between php scripts...i wanted to see if it was require problem or Form problem or session problem. All I know is that it does not change variable values.

ARG!!!
 
from a quick look, this looks like it would work if you sent the first data to sessionvariables2.php.

It actually looks at the moment like you send the data to $PHP_SELF and then when you hit the link to sessionvariables2.php you should be doing <a href='sessionvariables2.php?apieceofdata=somestuff&andanother=somemore'>|ENTER|</a> ***************************************
Party on, dudes!
[cannon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top