forms setting session on completion of a page


Please can someone point me in the correct direction. I am building a from from data coming in from any oracle db, from there, a table is build, and I am storing the information on a form. This is fine, and I can move across the four pages, of user input needed for the select statement, on the client site, the variables are being set correctly, and when I use the "get" method of moving between pages, I can see the correct HTTP_VARs being set. But, When I try to add all the information together, so the select can run, the last page can not read the HTTP_VAR information, even though I can read it from ther URL line. I have tired to place the infomation I need into a session file, but as that is set up before the user select the field, it does not contain any useful information. I have attached the code i am using below to build the table.
I am going arround in smaller and smaller circles here. I am using PHP 5 with register_globals off, as per the php suggestion.
Thanks in advance

header("Cache-control: private");
# ie 6 fix needed when useing session stuff
require_once ('Connections/') ;
$statement = OCIparse ($c, "select column_name from user_tab_columns where table_name = 'TBG_T_NAMES' ");
$col_name = array() ;
OCIexecute($statement, OCI_DEFAULT) ;
 while (OCIFetch($statement)) {
           $t=ociresult($statement, COLUMN_NAME);
            array_push($col_name, $t) ;


<form action="select2.php" method="post">
<table border="3">
<tr> <td></td><td>Yes</td><td>No</td><TD>who </TD></tr>

$i=400 ;
 foreach ( $col_name as $val) {
 $sess_val=$p.$i  ;
 session_register($name) ;
 <td><?php echo$val;?> </td> <?php $HTTP_SESSION_VARS['$sess_val']=$i; ?>
<TD><label><input name="<?php echo $HTTP_SESSION_VARS['$sess_val']; ?>" type=radio value="y" > </label></td>
<TD><label><input name="<?php echo $HTTP_SESSION_VARS['$sess_val']; ?>" type=radio value="n" > </label></td>
<TD><label><input name="<?php echo $HTTP_SESSION_VARS['$sess_val']; ?>" type=radio value="w" checked > </label></td>


<?php $i++ ;



unset ($i);

       <table border="4">
       <td><label><input name=number_of_sele type=text  value="" size="10">
<input type="submit" value="Get List">


Who is Participating?

Improve company productivity with a Business Account.Sign Up

hernst42Connect With a Mentor Commented:
If you are using each make sure the array pointer is set to the start. So try:
while (list($key,$value) = each($_GET));
If you are trying to get values from the URL (with the GET form method)

You should be using $_GET or $HTTP_GET_VARS


is that what you asking?
minichickenConnect With a Mentor Commented:
or if you are using "post" as the form method you should use $_POST or $HTTP_POST_VARS
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Are you sure this  $HTTP_SESSION_VARS['$sess_val'] is correct souldn't it be
'$sess_val' is the string $sess_val not the content of $sess_val
radical_mitAuthor Commented:
Hi minichicken,
sorry, I did not clean up the code completely, I have been tring all diffenet way.
When I change the posted PHP to $_GET I then get on the select Page
which is want I would expect. But then when I try to read it, via
while (list($key,$value) = each($_GET));
echo "$key = $value"
for example, there is no output
Where I would have expected to get something like p-401=w for example.

i think you should try this to see if there any values posted at all:

print_r ($_GET);
print_r ($_POST);

if you get an output like : Array ([p-400] => w , [p-401] => w , .....)

if no value is passed at all then: Array()
radical_mitAuthor Commented:
I get Array ( [p-400] => w [p-401] => w [p-402] => y [p-403] => n [p-404] => w [p-405] => w [p-406] => w [p-407] => w [p-408] => w [p-409] => w [p-410] => w [p-411] => w [p-412] => w [p-413] => w [number_of_sele] => ) =
radical_mitAuthor Commented:

I tried the reset($_GET); i still do not see any of the url line.

I have added

echo $key . "=" . $value . " <b>" ;
echo '$key' ;
echo "$key" ;

just to complete the output, I then get the third one $key outputed to the screen

I think hernst42 is right, you will need to reset the array. Look at this example straight from the PHP manual.


$fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');

while (list($key, $val) = each($fruit)) {
    echo "$key => $val\n";


a => apple
b => banana
c => cranberry

After each() has executed, the array cursor will be left on the next element of the array, or past the last element if it hits the end of the array. You have to use reset() if you want to traverse the array again using each.

Because assigning an array to another variable resets the original arrays pointer, our example above would cause an endless loop had we assigned $fruit to another variable inside the loop.
radical_mitAuthor Commented:
Hi Both,
Thanks for that, its looking a lot better, I will give more info later
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.