[support] Passing Variable between Forms
sivaji j.g
sivaji2009 at gmail.com
Tue Oct 21 17:40:20 UTC 2008
On Tue, Oct 21, 2008 at 3:12 AM, Kevin Davis <kevin at kevincdavis.net> wrote:
>
> Hello,
>
> I would like to know how to pass variables or information between on form in drupal to another form in drupal.
variable_set('variable_name','value') --> set the variable name and
its value in table {variable} and makes it accessible via
varialbe_get()
//from bootstrap.inc
<?php
function variable_set($name, $value) {
global $conf;
db_lock_table('variable');
db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')",
$name, serialize($value));
db_unlock_tables();
cache_clear_all('variables', 'cache');
$conf[$name] = $value;
}
?>
drupal_get('variable_name','default_vaule') --> this function will
check the table named {variable}
for variable if its found it will take its value otherwise
default_value will be taken
//from bootstrap.inc
<?php
function variable_get($name, $default) {
global $conf;
return isset($conf[$name]) ? $conf[$name] : $default;
}
--
Thanks a lot
-----------------------------------------
http://ubuntuslave.blogspot.com/
More information about the support
mailing list