Solved

get url blank

Posted on 2014-01-17
6
401 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 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 110

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

740 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