Jump to content

passing variables in hidden forms


pooker

Recommended Posts

Ok I will try to describe this the best I can. 

 

I have a script that performs calls another script when the submit button and passes the information via the post method.  It retrieves the information ok on the  next script but the problem is the script is constantly refreshed so I need to keep this value I got from the post method so I tried this

 

$chap = $_POST['url'];

 

I did this below because the script refreshes constantly so it would only store the value once

 

if ( $chap >= 1 ) {

$num = $chap;

}

 

You can see where it stores the variable so I need a way to keep this number the same

 

$dir = "./mangareader/bleach/chapter$num/";

 

so I read up on hidden variables I am was to think that this is how you do it so I tried above the submit button on this script and below it and it does not work

 

<input type="submit" name="submit" value="Next">

<input type="hidden" name="num" value="<?php print $num?>">

 

I need it to keep the $num value but it is not doing it. 

 

All help is appreciated

 

 

Link to comment
https://forums.phpfreaks.com/topic/111816-passing-variables-in-hidden-forms/
Share on other sites

I tried that but it still did not work maybe you can tell me what I did wrong please? 

 

On the initial script that uses the post method I used session_start(); there

 

then on the script that is constantly refreshed I did this

 

$chap = $_POST['url'];

if ( $chap >= 1 ) {

 

$_SESSION['num'] = $chap;

 

}

$num = $_SESSION['num'];

$dir = "./mangareader/bleach/chapter$num/";

 

it is not keeping the session for some reason?

Yes I tried that and this is what it does if I put session start on the other script

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/page.php:2) in /var/www/page.php on line 3

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.