[FX.php List] Retaining $_POST Requests in Form Redux

Steve Hannah shannah at sfu.ca
Thu Mar 1 15:24:48 MST 2007


Some time ago I had problems storing non-simple data types in session  
variables. (i.e. you could store strings but not arrays).  I can't  
remember if I was doing something wrong, but if you run into the same  
problem you may have to do
:
$_SESSION['postvars'] = serialize($_POST);

And then

$post_vars = unserialize($_SESSION['postvars']);

-Steve

----------------------------------------
Steve Hannah
Web Services Developer

Faculty of Applied Sciences
Simon Fraser University
shannah at sfu.ca
778-782-7228
Homepage: http://www.sjhannah.com
--
Need to build a database driven web application quickly?
Try Dataface: http://fas.sfu.ca/dataface



On 1-Mar-07, at 2:17 PM, DC wrote:

> yes, but you can store them in a session to keep them around  
> provided your redirect is to the same server.
>
> not sure if this would work, try it...
>
> $_SESSION['postvars'] = $_POST;
>
>
> then on your next page, they should be there as:
>
> print_r($_SESSION['postvars']);
>
> dan
>
> Jonathan Schwartz had written:
>> Hi Folks,
>> I would like to perform php error checking in the same page as the  
>> form, and then head of to the next page is no errors are found.   
>> The problem is when I detour to top of the same page to do the php  
>> testing, instead of heading directly to the target page, aren't  
>> the $_POST variables lost?
>> Would like to do both.
>> J
>> PSEUDO CODE:
>> <? if(isset($_POST['summit']) {
>>     if(errorisnotfound) {
>>     header('Location:nextpage.php')
>>     }
>>     }
>> ?>
>> <form action='thispage.php' type ="post'>
>> <input type="hidden" Name="2" value="this">
>> <input type="hidden" name="1" value="that">
>> <input type="submit" value="submit'>
>> </form>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070301/960c7b97/attachment.html


More information about the FX.php_List mailing list