I've been trying to figure out why this form doesn't work in Drupal 4.7.3. I recently download Drupal 4.7.3 and created this page. I get the infinite looping when I attempt to fill the edit table with the contents of an existing record. If I don't do the data fill, it works fine.
I also ran this code on Drupal 4.7.0 and it works fine. I did come across an old bug report on something similiar, but it didn't seem to apply. I've spent many hours trying to figure this one out so I hope someone can point out my solution.
<?php
function form_page() {
if( 1 ) { // comment this out for now
if( empty($_POST['edit']) ) {
// maybe need to prefill edit array from database based on specific GET/POST data
db_set_active('rs');
$res = db_query( 'select number from DID');
if( db_num_rows($res) > 0 ) {
$row = db_fetch_array( $res );
$_POST['edit']['form_id'] = 'form_page';
$_POST['edit']['ots'] = $row['number'];
}
db_set_active();
} else {
// edit array exists, use it as necessary
}
}
$form['ots'] = array(
'#type' => 'textarea',
'#title' => t('number'),
'#description' => t('Field Description'),
'#rows' => 5,
'#cols' => 60,
'#required' => 'true',
);
$form['dummy_id'] = array('#type' => 'hidden', '#value' => 'value' );
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'));