简体   繁体   中英

Textarea with TinyMCE. submit button won't work

Hi I'm making a form with a textarea using TinyMCE and when i press the submit button to send it to php DB, the button does nothing. I've put the textarea in commentary to see if it was the problem and it work so i've deduced that it was the problem.

There is my form code :

<div class="col-sm-12">
            <form id="RedactionForm" action="redaction_post.php" method="post">
                <?php
                // Connexion à la base de données
                try
                {
                    $bdd = new PDO('mysql:host=localhost;dbname=utilisateur;charset=utf8', 'root', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
                }
                catch(Exception $e)
                {
                        die('Erreur : '.$e->getMessage());
                }
                date_default_timezone_set('Europe/Paris');
                $date_creation = gmdate('Y-m-d h:i:s');
                ?>

                <div class="col-sm-6 form-group">
                  <label for="titre" class="control-label" id="label-redac">Titre</label>
                  <input type="text" class="form-control" name ="titre" id="titre" placeholder="Le titre" data-title="Le titre est obligatoire" required="" data-regex="^[a-zA-Z]{1,150}$">                                    
                </div>
                <div class="col-sm-6 form-group">
                  <label for="description" class="control-label" id="label-redac">Descritpion</label>
                  <input type="text" class="form-control" name ="description" id="description" placeholder="Une brève description de l'article" data-title="La description est obligatoire" required="" data-regex="^[a-zA-Z]{1,255}$">          
                </div>
                <div class="col-sm-12 form-group">
                    <label for="contenu" class="control-label" id="label-redac2">Article</label>
                    <textarea class="form-control" name="contenu" id="contenu" placeholder="Rédigez l'article ici" data-title="Le contenu de l'article est obligatoire" required=""></textarea>         
                </div>
                <input type='hidden' name='date_creation' id="date_creation" value="<?php echo "$date_creation";?>" />
                <div class="alert alert-danger">
                    Error!
                </div>
                <div class="alert alert-sucess">
                    Sent!
                </div>
                <div class="form-group">
                    <input type="submit" value="Envoyer l'article" class="btn-primary btn-sm"/>
                    <!--<button type="submit" class="btn-primary btn-sm">Envoyer l'article</button>-->
                    <a class="btn-primary btn-sm" href="./index.php"><span class="glyphicon glyphicon-chevron-left"></span>  Retour à la liste des articles</a>
                </div>
            </form>
        </div>

dont use "required" in tag <textarea> change sintaks

 <textarea class="form-control" name="contenu" id="contenu" placeholder="Rédigez l'article ici" data-title="Le contenu de l'article est obligatoire" required=""></textarea>   

to

 <textarea class="form-control" name="contenu" id="contenu" placeholder="Rédigez l'article ici" data-title="Le contenu de l'article est obligatoire"></textarea>   

maybe help you..

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