technotool Posted May 20, 2008 Share Posted May 20, 2008 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>  $_POST[date] <br> <b> Record#:</b> <br> <b>Pre-Operative Diagnosis:</b>    <b>Post-Op Diagnosis:</b>   $_POST[postop]<br> <b>Procedure:</b> $_POST[side]  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 More sharing options...
rhodesa Posted May 20, 2008 Share Posted May 20, 2008 So you want it to have all the styles, but still be editable? You will have to do a WYSIWYG editor. It has nothing to do with limitation in PHP...it just all client side actions... Link to comment https://forums.phpfreaks.com/topic/106398-editing-form-output-with/#findComment-545421 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.