This is a discussion on "HTTP_POST_VARS..." within the PHP Forum section. This forum, and the thread "HTTP_POST_VARS... are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
HTTP_POST_VARS...
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
HTTP_POST_VARS...
Hi there ppl,
Just starting out with PHP4 and require a little assistance with register_globals = Off. The 2 php pages work fine with the register_globals = On, but I must be using the HTTP_POST_VARS incorrectly or something. states.php is as follows: <?php $StatesOfTheUSA = array (1 => "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"); for ($counter=1; $counter<51; $counter++) { echo"<OPTION>$StatesOfTheUSA[$counter]</OPTION>"; } echo "</SELECT> "; for ($counter=1; $counter<51; $counter++) { echo"<INPUT TYPE=HIDDEN NAME='HiddenState[]' VALUE='$StatesOfTheUSA[$counter]'>"; } echo "<INPUT TYPE=SUBMIT></FORM>"; ?> capitals.php is as follows: <?php $StateCapital = array (0 => "Montgomery", "Juneau", "Phoenix", "Little Rock", "Sacramento","Denver","Hartford", "Dover","Tallahasse", "Atlanta", "Honolulu", "Boise", "Springfield","Indianapolis", "Des Moines", "Topeka", "Frankfort", "Baton Rouge","Augusta","Annapolis","Boston", "Lansing", "Saint Paul","Jackson", "Jefferson City", "Helena","Lincoln", "Carson City","Concord", "Trenton","Santa Fe", "Albany", "Raleigh","Bismarck","Columbus","Oklahoma City", "Salem", "Harrisburg", "Providence", "Columbia","Pierre", "Nashville", "Austin","Salt Lake City", "Montpelier","Richmond","Olympia","Charleston" , "Madison","Cheyenne"); for ($counter=0; $counter<50; $counter++) { if($HiddenState[$counter]==$State) { echo"The State capital is $StateCapital[$counter]"; } } ?> These work fine with register_globals = On , so could somebody show me how to use the HTTP_POST_VARS correctly in this scenario? Thanks. |
|
|
|
|||
|
All I can say is this is the strangest piece of code i've ever seen and way more complicated than it needs to be... Here's my take:
states.php
|
![]() |
| Tags |
| http_post_vars |
| Thread Tools | |
|
|