简体   繁体   中英

make confirm page before submit with php

I make a php form and i want to confirm before send to database, i make anther php form and echo data and use value=" but when i use tinymce it not work well and remove some part of special characters.

 <div class="form-group"> <script type="text/javascript" src="js/tinymce/tinymce.min.js"></script> <form action="" method="POST" accept-charset="utf-8" enctype="multipart/form-data"> <label for="usr">تهیه کننده نامه:</label> <input type="text" class="form-control" name="creator" value="" placeholder="تهیه کننده نامه"> <label for="usr">فرستنده نامه</label> <input type="text" class="form-control" name="sender" value="" placeholder="فرستنده نامه"> <label for="usr">گیرنده نامه</label> <input type="text" class="form-control" name="reciver" value="" placeholder="گیرنده نامه"> <label for="usr">موضوع</label> <input type="text" class="form-control" name="subject" value="" placeholder="موضوع"> <label for="usr">رونوشت:</label> <input type="text" class="form-control" name="copywriter" value="" placeholder="رونوشت"> <label for="usr">متن نامه:</label> <script type="text/javascript"> tinymce.init({ selector: 'textarea', plugins: 'directionality', toolbar: 'ltr rtl', toolbar: 'fontselect', font_formats: 'Nazanin= B Nazanin;Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;AkrutiKndPadmini=Akpdmi-n', height: 500, theme: 'modern', plugins: [ 'advlist autolink lists link image charmap print preview hr anchor pagebreak', 'searchreplace wordcount visualblocks visualchars code fullscreen', 'insertdatetime media nonbreaking save table contextmenu directionality', 'template paste textcolor colorpicker textpattern imagetools codesample toc help emoticons hr' ], toolbar1: 'fontselect | fontsizeselect | formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat |ltr rtl', image_advtab: true, templates: [ { title: 'Test template 1', content: 'Test 1' }, { title: 'Test template 2', content: 'Test 2' } ], content_css: [ '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i', '//www.tinymce.com/css/codepen.min.css' ] }); </script> <textarea name="text" rows="20" cols="60" class="form-control"></textarea> <input type="hidden" name="date" value="<?php echo date('Ym-d'); ?>"><br/> <input type="submit" value="ثبت" class="btn btn-primary" name="submit"> </form> 

and here i make confirm php page:

 <?php $creator = $_POST['creator']; $sender = $_POST['sender']; $reciver = $_POST['reciver']; $subject = $_POST['subject']; $copywriter =$_POST['copywriter']; $text = $_POST['text']; echo "<b>تهیه کننده</b>" . $creator . "<br/>"; echo "<b>فرستنده:</b>" . $sender . "<br/>"; echo "<b>گیرنده:</b> " . $reciver . "<br/>"; echo "<b>موضوع:</b> " . $subject . "<br/>"; echo "<b>رونوشت:</b> " . $copywriter . "<br/>"; echo "<b>متن نامه:</b> " . $text . "<br/>"; ?> <form action="" method="POST" accept-charset="UTF-8" enctype="multipart/form-data"> <input type="hidden" name="var" value="add"> <input type="hidden" name="creator" value="<?php echo $creator;?>"> <input type="hidden" name="sender" value="<?php echo $sender;?>"> <input type="hidden" name="reciver" value="<?php echo $reciver;?>"> <input type="hidden" name="subject" value="<?php echo $subject;?>"> <input type="hidden" name="copywriter" value="<?php echo $copywriter;?>"> <textarea name="text" rows="20" cols="60" class="form-control" value="<?php echo $text;?>"></textarea> <label for="usr">پیوست نامه</label> <input type="file" class="form-control" name="fileToUpload" id="fileToUpload" > <input type="submit" value="ثبت نهایی" class="btn btn-primary" name="submitfinal"> </form> 

master problem is in Textarea which it can not handle form correctly, it show some data but when user finly submit it not send all charaters such as

to database.

Try to change the selector with

tinymce.init({
    selector: '.textarea', -- .textarea

And put class over textarea

<textarea name="text" rows="20" cols="60" class="form-control text-area"></textarea>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM