diff --git a/action_page.php b/action_page.php new file mode 100644 index 0000000..6b4b250 --- /dev/null +++ b/action_page.php @@ -0,0 +1,9 @@ + + + +the $_POST data was converted into a php config file + + + + + Return to form and see the changes ! \ No newline at end of file diff --git a/config_page.php b/config_page.php new file mode 100644 index 0000000..5430768 --- /dev/null +++ b/config_page.php @@ -0,0 +1,186 @@ +true, + 'allow_user_to_config'=>false, + 'adresse_du_site'=>'www.warriordudimanche.net', + 'use_a_choice'=>'choice one',// current value: other values are defined below + 'use_a_radiobutton_choice'=>'choice one',// current value: other values are defined below + 'my_password'=>'password', + 'confirm_password'=>'', + +);*/ +//then render_form($config); + + +/* ##################################################################### + # auto_form config # + ##################################################################### + +*/ + +// here are the basic parameters +$autoform_config=array( + 'use_labels'=>true, + 'use_placeholder'=>true, + 'method'=>'post', + 'action'=>'config_page.php', + 'form_name'=>'autoform', + 'form_id'=>'autoform', + 'form_class'=>'autoform', + 'enctype'=>'', + 'submit_button_label'=>'Save changes', + 'reset_button_label' +); + +foreach (glob('design/*') as $skin){ + $skin=basename($skin);if ($skin!='index.html'){$skins[]=$skin;} +} +$autoform_config['skin']=$skins; +$autoform_config['default_data_folder']=array('private','public'); + +/* ##################################################################### + # the render function # + ##################################################################### + You can call it from anywhere in the page and render more than one form + just call render_form($data_array)to create a brand new form with differents + names, classes, ids etc. +*/ +function render_form($var){ + global $autoform_config;$all_keys=''; + $id=$class=$enctype=$reset=''; + if ($autoform_config['form_id']){$id=' id="'.$autoform_config['form_id'].'" ';} + if ($autoform_config['form_class']){$class=' class="'.$autoform_config['form_class'].'" ';} + if ($autoform_config['enctype']){$enctype=' enctype="'.$autoform_config['enctype'].'" ';} + if (isset($autoform_config['reset_button_label'])){$reset="';} + + echo '
"; +} +include('auto_restrict.php'); +include('config.php'); +unset($GLOBAL['private_data_folder']); +unset($GLOBAL['public_data_folder']); +$GLOBAL['default_data_folder']=basename($GLOBAL['default_data_folder']); + +$message=''; +if ($_POST){ + $auto_form['filename']='config.php'; + $auto_form['filecontent']=""; + + file_put_contents($auto_form['filename'],$auto_form['filecontent']); + if ($postdata['data_folder']!=$GLOBAL['data_folder']){ rename ($GLOBAL['data_folder'],$postdata['data_folder']);} + $message=' saved.'; + unset($postdata['all_keys']); + $GLOBAL=$postdata; +} +?> + + + + + +