Jump to content

This has to be one for the books!!!! PHP Variable won't display in URL


Bl4ckMaj1k

Recommended Posts

So I have these session variables being stored on login. Each page stores these session variables in local PHP variables. For some reason, all pages display that variable in the URL except one page. I have done some 'echo' work just to ensure variables have values stored and that everything was being read appropriately, no issues there. The variables are apparent everywhere on the page besides the URL. Below you can find all the code I have to make this thing work....maybe someone can point me in the right direction because I am STUMPED!!! LOL

 

So my first page calls a popup window in javascript defined below. The link involves the following PHP

 

   $customer_id = $_SESSION['cid'];
    $customer_email = $_SESSION['cust_email'];
    $customer_fname = $_SESSION['cust_first_name'];
    $customer_contact_id = $_SESSION['customer_contact_id'];
    $customer_company_id = $_SESSION['customer_company_id'];

    $c_project_id = $_GET['pid'];
    $c_project_id  = mysql_real_escape_string($c_project_id );
    $c_project_id = eregi_replace("`", "", $c_project_id);

 

 

Then comes in the Javascript...

 

<script type="text/javascript">
<!--
$(document).ready(function(){

$(".approval").click(function(){

v = $(this).attr("id");
url = 'deny_approval.php?cid=<?php echo "$customer_id"; ?>&company_id=<?php echo "$customer_company_id"; ?>&customer_contact_id=<?php echo "$customer_contact_id"; ?>&pid=<?php echo "$customer_project_id"; ?>&section=' + v;

window.open(url, "myWindow", 
"status = 1, toolbar = no, scrollbars = yes, location = no, resizable = no, height = 600, width = 600, resizable = 0" );

});

});
//-->
</script>

And finally, the HTML....

 

<body>
     	<a href="#" id="deny_quote_approval" class="approval">Deny Quote Approval</a><br /><br />
</body>

 

 

Any ideas?? As always, any help would be greatly appreciated.

 

Bl4ck Maj1k

Link to comment
Share on other sites

Remove the location=no and verify that the URL is correct.

If so, is deny_approval.php using $_GET or what?

 

Tried removing location = no but that didn't change the issue. I didn't think the structure of the deny_approval page would have anything to do with it's predecessor's link. The link address is being called in the page right before it. Deny approval uses the $_POST for its form and $_GET for the project ID. But the URL address is irrelevant if I can't get the previous page to go to the right address.

Link to comment
Share on other sites

Removing the location=no won't fix anything. The purpose is to make the deny_approval.php?... address visible to you. Then you look at the address and decide whether it is correct.

If it is correct then deny_approval.php is wrong. If it is not correct then at least the source page is wrong.

 

Also, your window.open will not pass any POSTed data. In deny_approval.php, $_POST will be empty. Everything is in $_GET.

Link to comment
Share on other sites

This issue blew my mind too hard the last couple days. I think it had something to do with the fact that I was running a javascript pop up function inside of a javascript popup window. For example:

 

Page 1 has a link that goes to a popup called Page 2.

Page 2 also has a link that goes to a popup called Page 3.

Page 3 wouldnt display the variables in the URL correctly.

 

In the end, I just separated those functions (Javascript popup window doesn't navigate to a page which has another javascript popup function. Instead the first window (Page 2) now controls all the functions) and all worked fine again. I wish I understood what the actual problem is but if I had to guess it had something to do with the two javascript functions conflicting which caused the variables in my PHP to output as NULL. Weird I know but its my only guess. The work around was easily coded though, no big deal.

 

Thanks all!!! This can be marked as solved.

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.