Solved

get url blank

Posted on 2014-01-17
6
396 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 30

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 30

Assisted Solution

by:Marco Gasi
Marco Gasi earned 100 total points
ID: 39789160
Sorry, I misunderstood :(
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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 30

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
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…

757 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

21 Experts available now in Live!

Get 1:1 Help Now