Jump to content

Recommended Posts

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>&nbsp $_POST[date]  <br>
<b> Record#:</b> <br>
<b>Pre-Operative Diagnosis:</b> &nbsp $_POST[preop] &nbsp <b>Post-Op Diagnosis:</b> &nbsp $_POST[postop]<br>
<b>Procedure:</b> $_POST[side]&nbsp $_POST[proclevel_1]&nbsp$_POST[proclevel_2]&nbsp$_POST[proclevel_3]&nbsp Lumbar Transforminal Epidural Steroid Injection with Epidurogram<br>
<b>Anesthesia:</b> &nbsp 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

 

Link to comment
https://forums.phpfreaks.com/topic/105810-output-from-forms-help/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.