Hey all
I'm writing a VERY useful module (for me anyway!) And so I'd appreciate some help with my problems so I can get it finisheed asap (and concentrate more on finishing my main module contribution).
Anyways... My function is this (obviously unfinished!):
function tablemanager_add() {
if (isset($_POST['submit'])){
$count = $_POST['edit']['cols'];
$name = $_POST['edit']['item1'];
$output = "hello " . $name . " bugger don't work" . $count;
print theme('page', $output);
return;
}
$tid = variable_get('tablemanager_table', '1');
$count = 0;
$fetch = db_fetch_object(db_query("SELECT * FROM {tablemanager} tm WHERE tm.tid = '$tid'"));
foreach ((unserialize($fetch->header)) as $a) {
$count++;
$output .= form_textfield($a, 'item' . $count, '', 60, 255, t("Enter your data for '$a' here"), NULL, FALSE);
}
$output .= form_hidden('cols', $count);
$output .= form(form_submit(t('Submit'), 'submit'));
$output .= l(t('Cancel'), 'admin/tablemanager');
print theme ('page', $output);
}
What I can't work out is why none of my elements are being returned? Now bear in mind that I'm NOT a programmer, I'm just tacking this all together as best I can so maybe I'm assuming that I can do things in php which are not actually possible? I'm wondering whether my passing an incrementing variable to the 'name' is invalid? When I view the source on the created page it does seem to work though? It's only after clicking submit that I can't retrieve any of the POST variables. I can't understand why this doesn't work, I've done similiar in other projects before - I think I must just be doing something stupid.