Jump to content

Editing form output with <textarea>?


technotool

Recommended Posts

not so beginner question:

 

I have a generic form (outside file) which is processed by the below php file .  The input data is first put into a template report (<<<html_tag) and then stored in the $output variable.  The $output variable is then placed in a <textarea> form field for any corrections by the end user.  If they like what they see they click finalize (submit)button and the [<textarea name="final_report">($PHPSELF Method=POST)] the $_POST['final_report'] displays for printout and the final_report(with corrections) saves the report into the database for later retrival if necessary.

 

Here is the question? when the $output displays in the textarea it shows the html tags:

 <p><b>etc..

 

Is there a way to show the enduser a version (notfinalized) of the report without the html tags that can still be edited and then saved as final.

 

Does anyone have experience with this?  Should I look in to third party software like fckeditor or wysig editor or can this be done with PHP alone.  Does PHP have the POWER?  Please help if you can. thnks in advance.

 

Technotool     

 

<?php
//
//php processing form
//
//
include ("../mylibrary/debug.php"); debug();   //debug
include ("../mylibrary/db_connect.php"); db_connect();   
require ("../config/config.php");  //configuration file with POST[array] conversions

//start inserting form data here $lastname = $_POST['lastname'] described inthe    
//config.config.php file
$output=<<<html_tag                

<head>
<link rel="stylesheet" type="text/css" href="../style/report.css" />
<link rel="stylesheet" media="print" type="text/css" href="../style/print.css" /> 
</head>

<body>

<div id="headertitle">
<p class="headertitle">
</p>
</div>

<div id="demographic">
<p class="content">
<b>Patient Name:</b> <b> $lastname, $firstname </b> <br>
<b>Date:</b>&nbsp $_POST[date]  <br>
<b> Record#:</b> <br>
<b>Pre-Operative Diagnosis:</b> &nbsp&nbsp <b>Post-Op Diagnosis:</b> &nbsp $_POST[postop]<br>
<b>Procedure:</b> $_POST[side]&nbsp 
html_tag;

///end template
///start $_POST[final_report] processing if hidden value formshow==noshow
//if not then go to else below where $output enters <textarea> for corrections.
if ($_POST['formshow']=='noshow')
    {  
    $final_report=$_POST['final_report'];
    echo $_POST['final_report'];
    $person_id="666";
    $sql="INSERT INTO `osemr`.`transcription` (
    `id` ,
    `person_id` ,
    `dictation` ,
    `created` ,
    `user`
    )   
    VALUES ('NULL', '$person_id','$final_report' ,CURRENT_TIMESTAMP , '$lastname')";
    $result=mysql_query($sql) or die ('Unable to add dictation');
    if ($result) echo "recorded";
    else "not recorded";
    }else   {///display $output in textarea for editing will show html tags
              
            echo "<form action=\"$PHPSELF\" METHOD=\"POST\">";
            echo "<textarea name=\"final_report\"  rows=\"50\" cols=\"100\">$output</textarea>";
            echo "<input type=\"submit\" name=\"submitvalue\" VALUE=\"finalize\">"; 
            echo "<input type=\"hidden\" name=\"formshow\" value=\"noshow\">";
            echo "</form>";
        
           }   
?>

Link to comment
https://forums.phpfreaks.com/topic/106398-editing-form-output-with/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.