Page 1 of 1

$_GET form values hiding?

Posted: Thu Apr 17, 2008 7:02 am
by coolin
Hi Please help I can't seem to figure out why the following result outputs from the following code extract

Code: Select all

 
<?php
$input = $_GET['by_price_higher'];
echo $input;
echo"<PRE>";
print_r($_GET);
echo"</PRE>";
?>
 
Output is as follows
Before submitting Form:
  • Array
    (
    [a] => 19
    )
After submitting form:
  • Array
    (
    [c] => 219
    => Array
    (
    [subcategories_also] => 1
    [optional_field_1] => 0
    [classified_auction_search] => 0
    [search_text] =>
    [search_titles] => 1
    [whole_word] => 0
    [by_zip_code] =>
    [by_zip_code_distance] => 0
    [by_price_higher] => 1000.00
    [search] => Search
    [question_value] => Array
    (
    [190] =>
    )

    )

    [a] => 19
    [change] => 0
    )


What I can't quite figure is why '1000.00' is not output at the front of the Form output shown here when the $_GET array appears to have values as spat out by the print-r command. Incidentally also the Form is submitting to itself (via <Form action ="" method="GET">)

Re: $_GET form values hiding?

Posted: Thu Apr 17, 2008 8:53 am
by aceconcepts
Try echoing $input alone or inside some <p> tags.

Re: $_GET form values hiding?

Posted: Thu Apr 17, 2008 8:57 am
by John Cartwright
I don't know why it wouldn't get echoed. What does a var_dump() say?

Re: $_GET form values hiding?

Posted: Thu Apr 17, 2008 12:07 pm
by coolin
Thanks, replacing the above code with the following -

Code: Select all

 
<?php
$input = $_GET["by_price_higher"];
echo"<p>
$input;hello
</p>";
var_dump();
?>
 
Just outputs:
  • ;hello

Re: $_GET form values hiding?

Posted: Thu Apr 17, 2008 1:56 pm
by onion2k
Isn't by_price_higher inside of an array called b? So you'd have to refer to it using $_GET['b']['by_price_higher']. You must have a really weird form to get that into _GET though...

Re: $_GET form values hiding?

Posted: Thu Apr 17, 2008 7:32 pm
by coolin
Thats perfectly right onion2K, couldn't see this format used elsewhere so was hard to find now so obvious though the form is a part of an application, doesn't appear visually so different I think the design intention was to have different categories of data- a, b & c hence the use of a 2D array to accomodate theses categories Thanks very much, now I can get on ammending my code further :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: