Page 1 of 1

simple question regarding moving data from one page onward

Posted: Fri Jul 28, 2006 10:11 pm
by mckooter
Okay ill admit im new, but ive read quite a few tutorials now and for some reason what I type is not causing the result i want, I assure you this is an easy question that I should have picked up but for one reason or another have not.

I am writing my frist script, this script shouldnt use a database so remember that when you see my horrible programming below, this script will just ask for data from user and do a calculation based on that data for loan availibility for retirement plans, this is my excuse to study at work, so that I may write a script that will help.

My problem is that I want to take data from a user on page1 and recall that data on page 4, each is its seperate page, and i have as you will see below passed the data using the POST feature, heres my script so far (the parts that i assume are causing the problem)

This is one of the commands I have used at the beginning to input user data, its transmitted through POST: (yes this is in a php form sending to second page)

Code: Select all

echo "<tr>
      <td alighn = 'right'> <B>Enter Active Loans:</br></td>
      <td><input type='text' name='aloan1' size='65' maxlegnth='65'>
      </td>
      </tr>";

The next page takes the data (i thought and assigns it to variables:

Code: Select all

global $aloan1;
$aloan1 = $_REQUEST['aloan1'];
And on the last page I am calling this data using:

Code: Select all

global $aloan1;
echo $aloan1;

I know im doing something wrong here, I just cannot figure it out, using my books the theory seems right

PS: i know thres probably a much simplier way to do this but I am just learning so im seeing if i can get something to work, in reality this script will calculate these values instead of just display them, but for testing i displayed them, assuming i had already messed something up.

Thanks for the help in advance, I am trying i promise


PSS: i forgot to mention, the problem is there is nothing displayed for those variables, all other echos work except those variables that i inevitably passed using an incorrect idea

Posted: Fri Jul 28, 2006 11:02 pm
by feyd

Posted: Fri Jul 28, 2006 11:48 pm
by mckooter
haha i know im an idiot now, my references that im using dont mention that i have to start a session

ill read more on sessions and if i need help ill ask again, thanks for the quick reply

Posted: Sat Jul 29, 2006 12:03 am
by Charles256
i read
My problem is that I want to take data from a user on page1 and recall that data on page 4, each is its seperate page, and i have as you will see below passed the data using the POST feature, heres my script so far (the parts that i assume are causing the problem)
and wanted to just reply sessions and leave it at that.but ithought..wait..let me read the rest of the post..in that time feyd had posted..doh.. :-D

Posted: Sat Jul 29, 2006 12:12 am
by mckooter
yeah i looked into it, and realised what i really was intending to do, this way feyd posted is much easier, if was was being noobish like i am what i was intending to do would have been: (and this is a question to see if this would also work I AM using sessions now to pass the variables)


something like:

Code: Select all

$aloan1 = $_REQUEST["aloan1"];
echo "<input type='hidden' name='aloan1' value='{$aloan1}'>";
i realize that syntax may be mistyped as i am learning but what i typed above (if typed correctly) would be the extremely long way to aquire the same goal correct?

(this question is just for learning purposes, it dosent apply to my script)

Posted: Sat Jul 29, 2006 12:27 am
by feyd
it's time independant, but is easily manipulated by the user as it is their agent that submits the data to the next page.

Posted: Sat Jul 29, 2006 12:34 am
by mckooter
thanks again, im not using that now just wanted to make sure i was thinking correctly, for peace of mind sake

now on to my last page, ill play with it a ton before i post my problems at this point :D

you have been helpful, and i appreciate it