jb489 Posted August 2, 2009 Share Posted August 2, 2009 Hi Guys, I have a table which i fill when the user puts in a username using this code: <div id="leftcolumn"> <div class="innertube"><b>Search for: </b> <br/><br/> <form action="Main.php" method="post"> <textarea name="username" cols="20" rows="1">Enter user name here...</textarea><br/><br/> <input type="submit" value="Go SAM !!"/> </form> </div> </div> this works fine, i am refreshing to the same page "Main.php", taking the $_POST["username"] and doing what i have to do with it. This fills up a table. Now on the first table i only show the first 10 results. Then i have two image buttons with net and previous which have the following code: <form method="post" name="DATA" action="<?php if(isset($_POST["lastResults"]) && ($_POST["lastResults"] != false)) { $_POST["lastResults"] = false; $page = $_SERVER['Main.php']; $sec = 1; echo $_SERVER['PHP_SELF']; //header("Refresh: $sec; url=$page"); } ?>"> <input type="image" src="images/buttonPrev.gif" title="Move to previous page of results"/> </form> <form method="post" name="Data" action="<?php if(isset($_POST["lastResults"]) && ($_POST["lastResults"] != true)) { $_POST["lastResults"] = true; $_POST["singleUserDatagrid"] = $_POST["singleUserDatagrid"]; $_POST["multipleUserDatagrid"] = $_POST["multipleUserDatagrid"]; $_POST["username"] = "testing"; $page = $_SERVER["Main.php"]; $sec = 1; echo $_SERVER['PHP_SELF']; //header("Refresh: $sec; url=$page"); } ?>"> <input type="image" src="images/buttonNext.gif" title="Move to next page of results"/> </form> This is again going back to "Main.php". But this time, when i access my $_POST array, i have nothing inside except for the image button position. I have 3 variables i have put into $_POST while the data is being loaded to the table using code like so: $_SESSION["custconfig"] = $custconfig; $_SESSION["singleUserDatagrid"] = $singleuser; $_SESSION["multipleUserDatagrid"] = $multipleuser; Can anybody help please ? Thanks Link to comment https://forums.phpfreaks.com/topic/168531-solved-losing-my-_post-data/ Share on other sites More sharing options...
smerny Posted August 2, 2009 Share Posted August 2, 2009 change $_POST["lastResults"] = true; etc.. to <input type='hidden' name='lastResults' value='true'> etc.. Link to comment https://forums.phpfreaks.com/topic/168531-solved-losing-my-_post-data/#findComment-889029 Share on other sites More sharing options...
wildteen88 Posted August 2, 2009 Share Posted August 2, 2009 You are overwritting your $_POST data when you submit your other two forms. What you'll have to do is pass the old $_POST data in either a hidden field in your other forms or via $_SESSION vars Link to comment https://forums.phpfreaks.com/topic/168531-solved-losing-my-_post-data/#findComment-889032 Share on other sites More sharing options...
jb489 Posted August 2, 2009 Author Share Posted August 2, 2009 so will this work ? <form method="post" name="Data" action="<?php if(isset($_POST["lastResults"]) && ($_POST["lastResults"] != true)) { echo $_SERVER['PHP_SELF']; } ?>"> <input type="image" src="images/buttonNext.gif" title="Move to next page of results"/> <input type='hidden' name='lastResults' value='true'> <input type='hidden' name='singleUserDatagrid' value='<?php echo($_POST["singleUserDatagrid"])?>'> <input type='hidden' name='multipleUserDatagrid' value='<?php echo($_POST["multipleUserDatagrid"])?>'> <input type='hidden' name='lastResults' value='true'> </form> Link to comment https://forums.phpfreaks.com/topic/168531-solved-losing-my-_post-data/#findComment-889035 Share on other sites More sharing options...
jb489 Posted August 2, 2009 Author Share Posted August 2, 2009 what i have in singleUserDatagrid and multipleuserDatagrid are 2 dimensional arrays. And these are not being sent across yet with the code above. any more suggestions ? Link to comment https://forums.phpfreaks.com/topic/168531-solved-losing-my-_post-data/#findComment-889081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.