Page 1 of 1

Help with multi form pages :(

Posted: Tue Oct 01, 2002 1:19 pm
by JPlush76
I have a page I made for a user to edit their account.. they can:
edit their billing address
edit their shipping
and edit their password

I used the same page for all three and just use a GET variable to do a SWITCH statement with.

IE to edit your password the link is: myedit?do=editpass

well everything works fine with register globals OFF, but when I upload it to my live server (which I can't touch) the globals are ON and it doesn't work, the URL goes blank, I've also turned my globals on locally and it fails as well... any thoughts?


When I hit submit with globals OFF url =
http://localhost/fs/sc_myedit.php?do=editpass

When I hit submit with globals ON =
http://localhost/fs/sc_myedit.php

Posted: Tue Oct 01, 2002 1:25 pm
by JPlush76
so I'd read the file like this

Code: Select all

<?php
switch ($_GETї'do']){

// IF THE USER WANTS TO EDIT THEIR ACCOUNT INFORMATION
case "editpass":
?>

<form action="<?=$PHP_SELF?>"  method="POST">

<INPUT TYPE="hidden" NAME="formcode" VALUE="editpass_done">

	<table width="70%" border="0" cellspacing="0" cellpadding="2">
                              <tr> 
                            <td align="right"></td>
                            <td> 
                             <B>Change My Password</B>
                            </td>
                          </tr>
						  <tr> 
                            <td align="right">Old Password:</td>
                            <td> 
                              <input type="password" name="f_oldpass" size="15" maxlength="15">
                            </td>
                          </tr>
						   <tr> 
                            <td align="right">New Password:</td>
                            <td> 
                              <input type="password" name="f_newpass1" size="15" maxlength="15">
                            </td>
                          </tr>
						  <tr> 
                            <td align="right">Confirm New Password:</td>
                            <td> 
                              <input type="password" name="f_newpass2" size="15" maxlength="15">
                            </td>
                          </tr>
                        
						  <tr>
                            <td align="right"></td>
                            <td>
                             <input type="submit" name="Submit" value="Change Password">
                            </td>
                          </tr>
                        </table>
	<!-- END EDIT SHIP -->
	
	</form>





<?php
// END OF ACCOUNT EDIT
break;
?>
and when I hit submit, at the top of the page I check the formcode variable to see which form to process

Posted: Tue Oct 01, 2002 2:13 pm
by Heavy
The page "Predefined variables" in the PHP Manual says:

Code: Select all

Warning

In PHP 4.2.0 and later, the default set of predefined variables which are available in the global scope has changed. Individual input and server variables are by default no longer placed directly into the global scope; rather, they are placed into the following superglobal arrays.

You can still force the old behaviour by setting register_globals to 'On' in your php.ini file.

For more information and background on this change, please see the PHP 4.1.0 Release Announcement.
And additionally:

Code: Select all

$_GET

Variables provided to the script via HTTP GET. Analogous to the old $HTTP_GET_VARS array (which is still available, but deprecated).
My comment:
Maybe your "live server" has an older PHP version than you?
Maybe it does not understand "$_GET"? It might believe that "$_GET" is just a variable like "$MyCounter" or "$StrHTMLOutBuffer".

Try uploading a page that uses the predefined array "$HTTP_GET_VARS" instead, and "$HTTP_POST_VARS" accordingly.