Closed ArtyomCZ closed 3 years ago
Hi, i just adding markdown support for my site and i have problem with this editor. Previously i used and form works normal.
Now i added this editor and Submit button stopped working. Can someone help with this?
Sample of my code:
PHP:
if (isset($_POST['submit'])) { if (!hash_equals($_SESSION['csrf'], $_POST['csrf'])) die(); try { $connection = new PDO($dsn, $username, $password, $options); $new_server = array( "Description" => $_POST['Description'], ); $sql = sprintf( "INSERT INTO %s (%s) values (%s)", "servers", implode(", ", array_keys($new_server)), ":" . implode(", :", array_keys($new_server)) ); $statement = $connection->prepare($sql); $statement->execute($new_server); } catch(PDOException $error) { echo $sql . "<br>" . $error->getMessage(); }
HTML:
<!-- Favicon --> <link rel="icon" href="../assets/img/brand/favicon.png" type="image/png"> <!-- Fonts --> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"> <!-- Icons --> <link rel="stylesheet" href="../assets/vendor/nucleo/css/nucleo.css" type="text/css"> <link rel="stylesheet" href="../assets/vendor/@fortawesome/fontawesome-free/css/all.min.css" type="text/css"> <!-- Argon CSS --> <link rel="stylesheet" href="../assets/css/argon.css?v=1.2.0" type="text/css"> <link rel="stylesheet" href="../assets/css/add-server.css" type="text/css"> <!-- SimpleMDE --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css"> <form role="form" method="post"> <input name="csrf" type="hidden" value="<?php echo escape($_SESSION['csrf']); ?>"> <div class="form-group"> <textarea name="Description" id="Description" placeholder="Popis serveru" type="text" required></textarea> </div> <div class="text-center"> <button type="submit" id="submit" name="submit" class="btn btn-primary my-4">Přidat server</button> </div> </form> <script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script> <script> var simplemde = new SimpleMDE({ element: document.getElementById("Description") }); </script>
I have more inputs in my form, for better debuging I just wrote here what doesn't work Editor is displayed normally only problem is sending data
I tried to delete textarea attributes and it works now
Hi, i just adding markdown support for my site and i have problem with this editor. Previously i used
Now i added this editor and Submit button stopped working. Can someone help with this?
Sample of my code:
PHP:
HTML:
I have more inputs in my form, for better debuging I just wrote here what doesn't work Editor is displayed normally only problem is sending data