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
https://forums.phpfreaks.com/topic/194861-help-with-popup-and-passing-_get-vars/
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.

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

 

 

I also believe there is confusion. I get the impression you are trying to use values in inputs to fill those values? If that's the case, PHP isn't even used.

 

Javascript can definitely grab those values though and compile a URL with the variables.

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.

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.