$_GET form values hiding?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
coolin
Forum Newbie
Posts: 21
Joined: Sun Mar 16, 2008 1:44 pm

$_GET form values hiding?

Post 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">)
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: $_GET form values hiding?

Post by aceconcepts »

Try echoing $input alone or inside some <p> tags.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: $_GET form values hiding?

Post by John Cartwright »

I don't know why it wouldn't get echoed. What does a var_dump() say?
coolin
Forum Newbie
Posts: 21
Joined: Sun Mar 16, 2008 1:44 pm

Re: $_GET form values hiding?

Post 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
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: $_GET form values hiding?

Post 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...
coolin
Forum Newbie
Posts: 21
Joined: Sun Mar 16, 2008 1:44 pm

Re: $_GET form values hiding?

Post 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:
Post Reply