PDA

View Full Version : display form input in another page



ketanco
13 Apr 2008, 11:37 PM
Hi,
I am trying to test a very simple form to see if i can display the input in another page. But it doesnt display anything in the destination page.

Here is the html code in the first file:
<form method="post" action"displayresults.php">
first input:<br/>
<input type="text" name="myinput1" />

and in displayresults.php I have the following code
$myinput1=$_POST['myinput1'];
echo $myinput1;
And it is not displaying any info that I entered.
I have two questions:
1-Why this does not work, what's wrong?
2-When I submit values in the first file, where and when do those values get stored? Does it get sent right away to the destination page? I mean lets say I submit info and then turn off my computer and then next day when I open displayresults.php is it supposed to show the result or do you need to do it in the same session, or how does this work?

jeremywilken
14 Apr 2008, 12:20 AM
<form action="displayresults.php" method="post">

You are missing the = sign in the action attribute. Those values are stored only as a one time accessible variable. The variable is carried only so far as the next page. If you want to save it over longer time, you have to save it in a cookie or in a database.