Solved

get url blank

Posted on 2014-01-17
6
397 Views
Last Modified: 2014-01-17
I am trying to set up a redirect url:

URL being passed to my page:
http://localhost/comwebsites/1callorders/site/orders_find_visit_print_custom_status_noforms_nocosts_idfilter2_ReadOnly.php?p=1&ID[78]&ID[79]&pldte=126&sourcedte=September%2027,%202012%207:46pm

----------------------------------
<?php
Page Code:
$dte = $_GET[sourcedte];

      foreach ($_GET[ID] as $key => $value) {
            //if ($value) {
            $red .= "&ID[$value]"; //build redirect link
            
                  }
                  //}

//
$url = "orders_find_visit_print_custom_status_noforms_nocosts_idfilter2_Redirect.php?p=1$red&amp;$dte";
//header('Location: '.$url); die;
var_dump($url);
?>
------------------------------------
Result of var_dump:
ng(120) "orders_find_visit_print_custom_status_noforms_nocosts_idfilter2_ReadOnly.php?p=1&ID[]&ID[]&September 27, 2012 7:46pm"

-------------------------------------
Question:
Why are the following fields blank when they are filled in the original url:
&ID[]&ID[]
0
Comment
Question by:doctorbill
6 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 400 total points
ID: 39789143
There is no value, if you want the key (the bit inside [ ]) then

$red .= "&ID[$key]"; //build redirect link
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39789150
$_GET is an array where ID is the key and78 is the value. You're trying to create an array with a duplicate key and this could the reason of your error. Why you pass two ID? They should have two significant different names...
0
 
LVL 31

Assisted Solution

by:Marco Gasi
Marco Gasi earned 100 total points
ID: 39789160
Sorry, I misunderstood :(
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39789182
This is what you will expect to find in the $_GET array.  Note that the ID array has numbered keys, and empty values.
array(4) {
  ["p"]=>
  string(1) "1"
  ["ID"]=>
  array(2) {
    [78]=>
    string(0) ""
    [79]=>
    string(0) ""
  }
  ["pldte"]=>
  string(3) "126"
  ["sourcedte"]=>
  string(25) "September 27, 2012 7:46pm"
}

Open in new window

0
 

Author Closing Comment

by:doctorbill
ID: 39789187
Solved - thanks a million
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39789200
Hi, doctorbill. I pray you to request attention to a moderator (you find the link below the question box, to the right) and award points to cathal only: his solution works fine (i just tested) and me, I said a greatly stupid think. In addition, other future users who can view this thread would'nt understand what solution is 'Sorry, I misunderstood...' :)

So, please, reassign points: it's not a hard work and it'll make EE a more rational place despite my stupid comment.

Thanks in advance
Marco
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now