alantony Posted May 15, 2008 Share Posted May 15, 2008 Hello, thanks in advance for your ideas. I am working to help a non-profit medical organization with required documentation. I have a few forms which must populate a number of transcription templates for a medical office. For example, input form: Last Name:<input type="text" name="last_name" size="15"><br> First Name:<input type="text" name="first_name" size="15"><br> output templates: <div id="demographic"> <p class="content"> <b>Patient Name:</b> <b> $_POST[lastname], $_POST[firstname] </b> <br> <b>Date:</b>  $_POST[date] <br> <b> Record#:</b> <br> <b>Pre-Operative Diagnosis:</b>   $_POST[preop]   <b>Post-Op Diagnosis:</b>   $_POST[postop]<br> <b>Procedure:</b> $_POST[side]  $_POST[proclevel_1] $_POST[proclevel_2] $_POST[proclevel_3]  Lumbar Transforminal Epidural Steroid Injection with Epidurogram<br> <b>Anesthesia:</b>   Local with 1% Lidocaine<br> <p> </div> here is another form: <div id="demographic"> <p class="content"> Patient Name, $_POST[lastname], $_POST[firstname] presents with a headache and neck pain on $_POST[date] <p> </div> I am trying to keep the code base clean and simple. would it make sense to store the templates in a database or have the input forms just populate the templates as individual files. This will lead to 40 or 50 template files and unique input forms <action="template file #1" METHOD="POST">. Your design thoughts would be greatly appreciated and how (in general)? thanks Quote Link to comment https://forums.phpfreaks.com/topic/105810-output-from-forms-help/ Share on other sites More sharing options...
phpzone Posted May 15, 2008 Share Posted May 15, 2008 I wouldn't put the templates in a database, better to store them on the filesystem. We used to put ours in a database but it becomes a pain updating and editing them in the DB, especially not easy to do a find and replace when compared to having them on the filesystem. Looking at your templates, I wouldn't use $_POST directly in the templates, I would first store them in a separate variables or array, you need to make sure that the values are properly encoded for including in HTML. I wasn't aware at one point, but do you know you can receive an array back directly from a form, you need to name your form fields as such: <input type="text" name="inputs[firstname]" value="{$inputs['firstname']}" /> <input type="text" name="inputs[surname]" value="{$inputs['surname']}" /> When the form posts back, you can get the entire set of inputs with: $inputs = $_POST['inputs']; Before outputting your template you could encode them all for HTML: foreach( $inputs as $key=>$value ) { $inputs[$key] = htmlspecialchars( $value, ENT_QUOTES ); } Just a view suggestions... You may also want to look at Smarty Templates, not everyone agrees with a templating system like Smarty, but if you want to offer the facility of editing their own templates to a client it can be great, because you can restrict being able to put any PHP code in. Hope these few comments help. Quote Link to comment https://forums.phpfreaks.com/topic/105810-output-from-forms-help/#findComment-542276 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.