By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,969 Members | 2,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,969 IT Pros & Developers. It's quick & easy.

passing vars - popup window problem

P: n/a
Hi,

I currently have a problem passing a variable value from one page to
another. Once a form submit button is pressed java pops up a window and
displays some information. The problem being is variables value needs to
be passed from the main page to this popup window ... but it isn't. why?
the submit button one the PHP page is

$s_download_action = "index.$phpEx?page=downloads";

$download_url = "download.$phpEx";

$hidden_download_vars = '<input type="hidden" name="download_id"
value="' . $d_id . '" />';
$u_download = "<input type=\"submit\" name=\"get_download\" value=\"" .
$lang['Download'] . "\" class=\"mainoption\" onClick=\"window.open('" .
$download_url . "', '_spdownload', 'HEIGHT=250,resizable=yes,WIDTH=
400');return false;\" />";
echo '<form action="' . $s_download_action . '" method="post">';
echo $hidden_download_vars . '' . $u_download;
echo '</form>';
Mar 15 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Steve wrote:
Hi,

I currently have a problem passing a variable value from one page to
another. Once a form submit button is pressed java pops up a window and
displays some information. The problem being is variables value needs to
be passed from the main page to this popup window ... but it isn't. why?
the submit button one the PHP page is

$s_download_action = "index.$phpEx?page=downloads";

$download_url = "download.$phpEx";

$hidden_download_vars = '<input type="hidden" name="download_id"
value="' . $d_id . '" />';
$u_download = "<input type=\"submit\" name=\"get_download\" value=\"" .
$lang['Download'] . "\" class=\"mainoption\" onClick=\"window.open('" .
$download_url . "', '_spdownload', 'HEIGHT=250,resizable=yes,WIDTH=
400');return false;\" />";
echo '<form action="' . $s_download_action . '" method="post">';
echo $hidden_download_vars . '' . $u_download;
echo '</form>';


This looks more like javascript, not java.

And I don't see any problem with your PHP code. But it looks like there
are problems with your html and javascript.

First of all - the submit button isn't in the form. Why not? Or is
there more you haven't shown us?

Next, I don't see where you're passing the value to the popup window in
your javascript.

Try a javascript newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 15 '06 #2

P: n/a
"Try a javascript newsgroup." - nope this is more of an html question.
Maybe try an html newsgroup, as this is a common html mistake...

Anyway, the problem is that you are passing a get variable here
(instead of a post var):

$s_download_action = "index.$phpEx?page=downloads";

which is the wrong way to sumbit a get variable through an html form
anyway. Especially when you declare:

method="post"

The possible solution is to have a hidden field like:

<input type="hidden" name="something" value="$s_download_action">

and then catch that in the popup as:

$s_download_action_is=$_POST['something'];

of course, if you wish to use

method="get"

then the above would be

$s_download_action_is=$_GET['something'];

Mar 15 '06 #3

P: n/a
d
"Steve" <stuck@need_help.co.uk> wrote in message
news:Xn********************************@195.92.193 .157...
Hi,

I currently have a problem passing a variable value from one page to
another. Once a form submit button is pressed java pops up a window and
displays some information. The problem being is variables value needs to
be passed from the main page to this popup window ... but it isn't. why?
the submit button one the PHP page is

$s_download_action = "index.$phpEx?page=downloads";

$download_url = "download.$phpEx";

$hidden_download_vars = '<input type="hidden" name="download_id"
value="' . $d_id . '" />';
$u_download = "<input type=\"submit\" name=\"get_download\" value=\"" .
$lang['Download'] . "\" class=\"mainoption\" onClick=\"window.open('" .
$download_url . "', '_spdownload', 'HEIGHT=250,resizable=yes,WIDTH=
400');return false;\" />";
echo '<form action="' . $s_download_action . '" method="post">';
echo $hidden_download_vars . '' . $u_download;
echo '</form>';


Your form is not actually submitting anything. The submit button is
returning false, which will cancel the form being submitted anywhere. You
could replace the submit with a button, have that create a new window, have
the new window (once loaded) call the opening document, and submit the form
to itself. You can specify a name for the window in the javascript that
creates it, and you can specify a "target" in your <form>. It's messy, but
will have you submitting to a pop-up box.

Posting to a pop-up box seems somewhat dirty. :-P
Mar 15 '06 #4

P: n/a
"d" <d@example.com> wrote in
news:MQ******************@text.news.blueyonder.co. uk:
"Steve" <stuck@need_help.co.uk> wrote in message
news:Xn********************************@195.92.193 .157...
Hi,

I currently have a problem passing a variable value from one page to
another. Once a form submit button is pressed java pops up a window
and displays some information. The problem being is variables value
needs to be passed from the main page to this popup window ... but it
isn't. why?
the submit button one the PHP page is

$s_download_action = "index.$phpEx?page=downloads";

$download_url = "download.$phpEx";

$hidden_download_vars = '<input type="hidden" name="download_id"
value="' . $d_id . '" />';
$u_download = "<input type=\"submit\" name=\"get_download\" value=\""
. $lang['Download'] . "\" class=\"mainoption\"
onClick=\"window.open('" . $download_url . "', '_spdownload',
'HEIGHT=250,resizable=yes,WIDTH= 400');return false;\" />";
echo '<form action="' . $s_download_action . '" method="post">';
echo $hidden_download_vars . '' . $u_download;
echo '</form>';


Your form is not actually submitting anything. The submit button is
returning false, which will cancel the form being submitted anywhere.
You could replace the submit with a button, have that create a new
window, have the new window (once loaded) call the opening document,
and submit the form to itself. You can specify a name for the window
in the javascript that creates it, and you can specify a "target" in
your <form>. It's messy, but will have you submitting to a pop-up
box.

Posting to a pop-up box seems somewhat dirty. :-P


I see your point about being dirty! but its only a confirmation window
once the download button is pressed. basically its just saying "The
requested file 'blahblahblah.zip' will download in the next 3 seconds.

might look at onther way instead ... but thanks anyway.
Mar 16 '06 #5

P: n/a
"Tyxod" <yr****@gmail.com> wrote in news:1142427614.295685.117830
@i39g2000cwa.googlegroups.com:
"Try a javascript newsgroup." - nope this is more of an html question.
Maybe try an html newsgroup, as this is a common html mistake...

Anyway, the problem is that you are passing a get variable here
(instead of a post var):

$s_download_action = "index.$phpEx?page=downloads";

which is the wrong way to sumbit a get variable through an html form
anyway. Especially when you declare:

method="post"

The possible solution is to have a hidden field like:

<input type="hidden" name="something" value="$s_download_action">

and then catch that in the popup as:

$s_download_action_is=$_POST['something'];

of course, if you wish to use

method="get"

then the above would be

$s_download_action_is=$_GET['something'];


the variable I am trying to obtain is a hidden var

$hidden_download_vars = '<input type="hidden" name="download_id"
value="' . $d_id . '" />';
which is in the form like this

echo '<form action="' . $s_download_action . '" method="post">';
echo $hidden_download_vars . '' . $u_download;
echo '</form>';
the get var your on about in the form element is not the var i am trying
to obtain in the popup window. I need the download_id var as above.

will try it as GET anway and see what happens.

thanks.
Mar 16 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.