I try to do an insert into my database using a form but it fails.
My field type is longtext, because I want to add an iframe link.
Can someone help me?
Here is my source code :
if (isset($_POST['valider']))
{
$connect = new PDO('mysql:host=localhost;dbname=horseblog;charset=utf8', 'root', '');
$res = $connect->exec('INSERT INTO musique SET lien="'.$_POST['lien'].'"');
header("location:mainPage.php");
}
My form :
<form class="form-inline" method="post" action ="ajoutMusic.php">
<div class="form-group">
<label for="exampleInputName2">LIEN :</label>
<input type ="text" class="form-control" name="lien" style="margin-left: 5%;" /><br/><br/>
<span style="width: 200px"></span>
</div>
<input class="btn btn-warning"style="margin-left: 3%; "type="submit" name="valider" value="ajouter"><br/><br/>
</form>