Jump to content

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.

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.