Jump to content

Help with Popup and passing $_GET vars


tqla

Recommended Posts

Hello. Can someone help me get this to work?

 

The popup works when I put a simple url in the Action but stops working when I add the long URL with the $_GET vars. Nothing happens, no popup. I've tried a lot of things but can't get it to work.

 

Here is my popup code

<SCRIPT LANGUAGE="JavaScript">
function popup(w,h,p){
var left = (screen.availWidth/2) - (w/2);
var top = (screen.availHeight/2) - (h/2);
window.open(p,'Comp','width='+w+',height='+h+',scrollbars=0,status=0,menubar=0 left='+left+', top='+top)
}
</SCRIPT>

 

And here is my Form Action

<form id="form1" name="form1" method="get" action="javascript:popup(1050,650,'http://www.mywebsite.com/comparison.php?s1=$_GET['s1']&s2=$_GET['s2']&s3=$_GET['s3']&s4=$_GET['s4']&s5=$_GET['s5']&s6=$_GET['s6']')">

 

 

Link to comment
Share on other sites

You do not show where those $_GET variables come from, or what sort of values they contain.

 

One thing that will help, is if you test this in firefox with the error console open, it will reveal where it is having issues.

Link to comment
Share on other sites

Okay, when I escape the apostrophies the popup now pop's up but the GET's are not getting. They appear like this:

comparison.php?s1=$_GET['s1']&s2=$_GET['s2']&s3=$_GET['s3']&s4=$_GET['s4']&s5=$_GET['s5']&s6=$_GET['s6']

 

Is there a special way to get the GET to work in a JS popup? 

 

Without the javascript the GET's work fine.

Link to comment
Share on other sites

tried /comparison.php?s1=<?php echo $_GET['s1']?>' and the resulting popup url reads "?s1=" . The GET var is not passing. I tried POST too.

 

It appears that the method="get" is bypassed when using the popup.

 

 

 

.

Link to comment
Share on other sites

I think there is some confusion here

 

if the popup is another page like xyz.php then you will need to pass the variables to it in the normal manner in the url, or use the session.

 

So you will need to have xyz.php?var1=blah ...

 

 

Link to comment
Share on other sites

Yes, I am using a form and PHP is passing the vars using $_GET to creat the url for the comparison.php page. It works fine.

 

But when I try to open comparison.php in a popup window using the js popup function the $_GET vars are not passed.

 

So, judging by what you all are saying, JS needs to do the GET work and not PHP. I will go back and start over using soley JS to process the form and create the URL for the comparison page.

 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.