i have a custom module in drupal 6.It prints output in another file by appending the output at the end of that file ,when i am selecting my options in a drupal form,which has a dropdown also.When i am selecting the same dropdown option with the same set of options,it prints the same output in that file.I want to overwrite those similar lines in that file.How can i do it.Can you suggest the code changes ASAP.I have given my custom module code below.
Please help.
**roleuseradd.info**
name = Role add users
description = Allows roles to be added as users.
core = 6.x
; Information added by drupal.org packaging script on 2010-09-13
version = "6.x-1.1"
core = "6.x"
project = "roleuseradd"
datestamp = "1284408708"
***roleuseradd.module***
<?php
/*
* Implementation of hook_form_alter()
*/
function roleuseradd_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'user_admin_new_role' || $form_id == 'user_admin_account'||$form_id == 'user_profile_form') {
$form['#submit'][] = 'roleuseradd_rid_submit';
}
}
function roleuseradd_rid_submit($form, &$form_state){
//print_r($form_state['values']);exit();
$role_name = $form_state['values']['name'];
db_set_active('mediawiki');
$sql="INSERT into wiki_user_groups(ug_group) VALUES ('$role_name')";
db_query($sql);
//Switch back to the default connection when finished.