?
Solved

get url blank

Posted on 2014-01-17
6
Medium Priority
?
404 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 1600 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 400 total points
ID: 39789160
Sorry, I misunderstood :(
0
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 
LVL 111

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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

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…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

764 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