PDA

View Full Version : vb3: New Profile Fields = Nothing Sent to UPDATE in query. [solved]


Harlequin
02-07-2004, 10:27 PM
In vb2, everything in the config file I'd written read and saved fine. However, with vb3, there's a whole new world of hurt with how vb3 reads and saves it's <form> information. :)

Simply put, the form doesn't save anything. I've figured out all of the redirecting stuff in profile.php and the seperate config file I've written (I upgraded it to the request and post stuff vb3 requires, as well as the template output and redirection..)

But nothing saves.

I've even put a 1 in the query just to mess it up so I can actually verify that nothing was being transferred from the form to the query save.. and sure enough, nothing was being passed into the variables.

Am I correct in assuming that [i]globalize now works the way forms transmit their data into the query to save? If that's the case, how does globalize need to be typed up for example?

Am I missing any other big points on how to transfer this information?


Just curious. :)

g-force2k2
02-07-2004, 10:36 PM
I believe that the globalizing is done in the init.php and adds the variable to the $_POST array, to add variables you have to sue the globalize function. for example:

globalize ( $_POST, array ( 'variable1', 'variable2' ) ) ;

Hope that helps,

Cheers,
g-force2k2

Harlequin
02-11-2004, 06:39 PM
Thanks g-force! Again and again. :)

For anyone else new to coding in vb3 with this or curious, in the following statement:


if ($_POST['do']=="NAMEOFPOSTIF")
// do is the action being sent here, NAMEOFPOSTIF is do's command


Place this at the top:



// replace LETTERS with any character string being sent to write/update.
// replace NUMBERS with any numeric string being sent to write/update.
globalize($_POST, array('LETTERS' => STR, 'NUMBERS' => INT));



To add more than just one or two fields to write, just continue with STRs or INTs with commas after each.. until the last one of course. :)

Also note in your templates that to process your form, an extra <input> in the form must be something like:



<input type="hidden" name="do" value="NAMEOFPOSTIF">




Hope this helps any new coders.

Andreas
02-11-2004, 06:46 PM
For security-reasons it's generally not a good idea to globalize all variables at the top ,otherwise we could just leave register_globals on ;).

Use globalize carefully only at places where you really need it (eg. in your $_REQUEST['do'] = 'foobar' {}), and only for those variables you are going to process.

Harlequin
02-11-2004, 06:48 PM
Thanks for the tip. :)