Click to See Complete Forum and Search --> : Post to active page


kproc
04-13-2006, 08:43 PM
Hi

I have create many forms which I can get to post the results to a new webpage

i.e. <form name="mortgagepenalty" id="horizontalForm" action="../mortgagepenaltysummary.php" method="post">

were "mortgagepenaltysummary.php" is the new web page that the results are written to.

----

who can I get it to write the results to the same page that the form is on. I would like the results to insert below the form when the submit button is clicked

any ideas

thank you

balloonbuffoon
04-13-2006, 08:55 PM
Put this below your form:
<?
if (is_array($_POST)) {
foreach ($_POST as $name => $value) {
echo $name, " = ", $value, "<br>";
}
}
?>You'll probably want the output more formatted, but that shouldn't be hard to do.

--Steve

kproc
04-13-2006, 09:05 PM
I gave the code you posted above a try and nothing happened, shoul di change the method and post to some new value

kproc
04-13-2006, 09:08 PM
Hey, I figured it ot. how would I fix it up so that I create a string with each variable.

i.e. the answer to var x + var y = var t

balloonbuffoon
04-13-2006, 09:16 PM
Try this:
<?
if (is_array($_POST)) {
echo "The answer to ", $_POST["x"], " + ", $_POST["y"], " = ", ($_POST["x"]+$_POST["y"]);
}
?>

--Steve

kproc
04-13-2006, 09:31 PM
hey, thank you for your help.

I have another page where all the values poplulate to text objects,

I would like to offer a link under the form that links to a results summary page, which pulls the data form the form that has already been calculated. would I create the link and pull the form values through

thank you

balloonbuffoon
04-13-2006, 09:40 PM
I would use serialize() and unserialize(), like this:<?
echo "<a href='summary.php?data=", serialize($_POST), "'>Summary</a>";
?>
Then in "summary.php":<?
$data = $_GET["data"];
$values = unserialize($data);
//$values has all the posted info from the previous page, in array form
//$values["x"]
//$values["y"]
//etc...
?>

--Steve

kproc
04-13-2006, 09:53 PM
thank you once again for the help.

do I need tye value "data to something that matches in the previos page

balloonbuffoon
04-13-2006, 09:56 PM
Not as long as you use this;<?
echo "<a href='summary.php?data=", serialize($_POST), "'>Summary</a>";
?>

--Steve

kproc
04-13-2006, 09:59 PM
The only thing that I changes was the page name. when I click on the link it opens the page but it is blank.

the info in the address bar is
http://www.tomorrownextweek.com/calculators/testpage.php?data=a:0:{}


not shure what I'm doing wrong

thankyou for your help

kproc
04-13-2006, 10:05 PM
The button that runs the form is set as a button and not as submit. I want the values to be left in the form and give the user the option to go to the summary screen

balloonbuffoon
04-13-2006, 10:51 PM
This page currently isn't set to display anything, you have to put that in there yourself, based on your needs:<?
$data = $_GET["data"];
$values = unserialize($data);
//$values has all the posted info from the previous page, in array form
//$values["x"]
//$values["y"]
//etc...
?>

--Steve

kproc
04-13-2006, 11:02 PM
I'm not shur3e I'm understanding. '


I changed the value in //$values["x"]
with //$values["gross"]. Gross is a name of a form field and noth happends, I'm sure I'm missing somthing simple.

IO want to use the value sin a string

balloonbuffoon
04-13-2006, 11:13 PM
You are aware of the simple PHP function called "echo" and that "//" makes the following text a comment and not a command, yes?
You would have to do something like the following:
<?
$data = $_GET["data"];
$values = unserialize($data);
//$values has all the posted info from the previous page, in array form
//$values["x"]
//$values["y"]
//etc...
echo $values["gross"];
?>

--Steve

kproc
04-14-2006, 08:28 AM
I'm problely missing somthing very simple.

Below is the info that is put in the address bar when I click on the link.

I copied your last post in to the page and nothing is showing up.

Also, when the submit button is clicked it clears the form, I would like to have the values remain in the form

http://www.tomorrownextweek.com/calculators/testpage.php?data=a:11:{s:5:%22gross%22;s:5:%2275000%22;s:4:%22payF%22;s:2:%2226%22;s:4:%22fPay%22;s :10:%2201/01/2006%22;s:7:%22cppFull%22;s:7:%22$136.13%22;s:7:%22cppLast%22;s:5:%22$4.88%22;s:11:%22cppFullDate%22 ;s:10:%2207/16/2006%22;s:11:%22CPPLastDate%22;s:10:%2207/30/2006%22;s:6:%22eiFull%22;s:6:%22$53.94%22;s:6:%22eiLast%22;s:6:%22$28.08%22;s:10:%22eiFullDate%22;s: 10:%2207/02/2006%22;s:10:%22eiLastDate%22;s:10:%2207/16/2006%22;}

Form info


<form id="horizontalForm" name="ded" method="POST">
<input id="submit" type="submit" value="Calculate" onclick="compute(this.form)" />

thank you for your time and patentice