Ask a Question related to PHP Development, Design and Development.
-
Angelo Zanetti #1
problem passing variable between forms.
HI all
I have a form in which I have a table with dynamic checkboxes, they are in a
checkbox array ( name = chk[]...), I pass this variable to the next page
using POST I receive the variable and use it, no problem, but then when I
try to pass it to the next form in the URL (using an A HREF:
<a href='confirmrequest.php?requested=" . $chk . "'> )
then it doesnt get passed. I have also tried sending it with POST and a
submit button
On the page that receives the variable (or meant to ) I have tried this with
POST:
$chk_array = $_POST['chk'];
================================================== =====
and this with sending the variable as part of the URL:
echo("count chk: " . count($requested). "<br>");
================================================== =====
My register_globals is off. I am not sure what Im doing wrong,
Help would be appreciated
Thanx In advance
Angelo
Angelo Zanetti Guest
-
Passing a variable to asp
I cannot work out how to get the variable namefirst from flash to the asp I use : ... -
Passing a variable
Hello, I know this is a simple question but I can't continue because of this error. My first program has this line <cflocation... -
Parse problem passing a variable through an a href
This is probably just a silly error, although I can't see it. I'm wanting to pass a variable I've set through an a href. I know the variable... -
passing javascript variable into asp variable using vbscript
The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script... -
Passing URL Variable in PHP
Scott D wrote: echo '<a href=test.php?varName=', urlencode($headquarters_name), '>', $headquarters_name, '<br></a>'; Then in the target... -
Cpt John W. Holmes #2
Re: [PHP] problem passing variable between forms.
----- Original Message -----
From: "Angelo Zanetti" <binc2@ctech.ac.za>a> I have a form in which I have a table with dynamic checkboxes, they are inYou need to serialize() the array in order to pass all of it's values.> checkbox array ( name = chk[]...), I pass this variable to the next page
> using POST I receive the variable and use it, no problem, but then when I
> try to pass it to the next form in the URL (using an A HREF:
>
> <a href='confirmrequest.php?requested=" . $chk . "'> )
$ser = urlencode(serialize($chk));
$url = "confirmrequest.php?requested=$ser";
Then on the receiving side...
$chk = unserialize($_GET['requested']);
You could also just add it to the session and make it easy...
$_SESSION['chk'] = $chk;
and on the receiving page:
$chk = $_SESSION['chk'];
---John Holmes...
Cpt John W. Holmes Guest
-
Lowell Allen #3
Re: [PHP] problem passing variable between forms.
> I have a form in which I have a table with dynamic checkboxes, they are in a
Isn't $chk an array? To pass an array in a form, you should serialize it and> checkbox array ( name = chk[]...), I pass this variable to the next page
> using POST I receive the variable and use it, no problem, but then when I
> try to pass it to the next form in the URL (using an A HREF:
>
> <a href='confirmrequest.php?requested=" . $chk . "'> )
>
> then it doesnt get passed. I have also tried sending it with POST and a
> submit button
encode it, then after receiving it you decode it and unserialize it:
$portable_array = base64_encode(serialize($array));
You can then pass $portable_array as a form hidden input value. To turn it
back into an array:
$array = unserialize(base64_decode($portable_array));
--
Lowell Allen
Lowell Allen Guest
-
Chris Shiflett #4
Re: [PHP] problem passing variable between forms.
--- Angelo Zanetti <binc2@ctech.ac.za> wrote:
....> I pass this variable to the next page using POST I receive the
> variable and use it, no problem, but then when I try to pass it
> to the next form in the URL (using an A HREF:
>
> <a href='confirmrequest.php?requested=" . $chk . "'> )Read back through your question, and at least one problem should be very clear:> My register_globals is off.
1. The client sends you data in a POST request.
2. You have register_globals disabled.
3. You reference $chk.
You need to reference this as $_POST['chk']. Read this:
[url]http://www.php.net/register_globals[/url]
Also, as others have mentioned, you need to understand how to work with arrays
a bit more. The manual can be very helpful. Read this:
[url]http://us2.php.net/array[/url]
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
[url]http://httphandbook.org/[/url]
Chris Shiflett Guest
-



Reply With Quote


