proctk Posted April 14, 2006 Share Posted April 14, 2006 HI I have a form on my web page that has a link at the bottom which opens a summary page. my goal is to display the data from the form on the summary page.The code below somewhat works but when the link is clicked nothing displays on the summary page. when the button is clicked it cleares the data on the form, what to leave the data in the form fields.I believe the issue has something to do with the code on the summary page, as all the values are transfered to the adress bar when the submit button is clickedAny help is great thank youthe below code it attached to the bottom of the form [code]// form code <form id="horizontalForm" name="ded" method="POST"><input id="submit" type="submit" value="Calculate" onclick="compute(this.form)" />//------------<?echo "<a href='testpage.php?data=", serialize($_POST), "'>Summary</a>";?> [/code]code attached to the summary page[code]<?$data = $_Get["data"];$values = unserialize($data);//$values has all the posted info from the previous page, in array form//$eiLastDate = $values["eiLastDate"];//$values["y"]//etc...echo $values["eiLastDate"];?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7425-unserialize-serialize/ Share on other sites More sharing options...
litebearer Posted April 14, 2006 Share Posted April 14, 2006 Your form page is using the POST method, while your summary page is using the GET method Quote Link to comment https://forums.phpfreaks.com/topic/7425-unserialize-serialize/#findComment-27108 Share on other sites More sharing options...
proctk Posted April 14, 2006 Author Share Posted April 14, 2006 Thank you for the reply, I changed the summary page to post and nothing changed Quote Link to comment https://forums.phpfreaks.com/topic/7425-unserialize-serialize/#findComment-27113 Share on other sites More sharing options...
litebearer Posted April 14, 2006 Share Posted April 14, 2006 ok, had my meds and a glass of wine, ready to do battle (from the movie michael).I could be mistaken (its happened twice - once in 1953 and once in 1979) but when you click on the Summary link, for all intent and purposes, the data in the form is NOT submitted.As an experiment, do the following...1. test form page that uses same fields BUT do not have the summary button/link. Instead, make an extra data field (a check box perhaps) that the user checks if they want to see a summary.2. make the process page get the variables from the form using the POST method.3. in the process page, IF the summary field has been checked, then display the summary. Else do your other processing.ie (psuedo php)[code]if (button == yes) { display summary;}else { do something else;}[/code]Lite... Quote Link to comment https://forums.phpfreaks.com/topic/7425-unserialize-serialize/#findComment-27120 Share on other sites More sharing options...
proctk Posted April 15, 2006 Author Share Posted April 15, 2006 Thank you for the relpy, I'm way to new at this and don't really undersand what you want me to do Quote Link to comment https://forums.phpfreaks.com/topic/7425-unserialize-serialize/#findComment-27124 Share on other sites More sharing options...
litebearer Posted April 15, 2006 Share Posted April 15, 2006 Ok rather than writing the code for you, we are trying to make the concepts clear.try these two simple files.[code]<html><head><title>test form</title></head><body>Once you understand what is happening, modify this page to get the data you want<form action="testform01.php" method="post">first name: <input type="text" name="firstname" size="40" maxlength="80" value=""><br>last name: <input type="text" name="lastname" size="40" maxlength="80" value=""><br>check this if you would like to see a summary: <input type="checkbox" name="showsummary" value="1"><br><input type="submit" value="Submit"></form></body></html>[/code][code]<?PHP###################### this is the test form page 2#$showsummary = $_POST['showsummary'];$firstname = $_POST['firstname'];$lastname = $_POST['lastname'];if (isset($showsummary)) { echo "The checkbox was clicked <br>"; echo "Your name is " . $firstname . " " . $lastname; //display your summary here} else { echo "The checkbox wasn't clicked"; // do something else} ?>[/code]Hope this isn't too muddy.Lite... Quote Link to comment https://forums.phpfreaks.com/topic/7425-unserialize-serialize/#findComment-27136 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.