I have a little problem with a php page that display an sqlite database and get the possibility to edit some value.
My problem is that short string are write on my database while large string are not write on database.
This is my code:
(i think that there are a lot of error, but I don’t know php 🙁 )
<div id="editor">
<?php
if($_POST['NewText']){
$textNew = $_POST['textAreaTesto'];
$db->exec("UPDATE Argomenti_".$_SESSION[sessioneMateria]." SET Testo='".$textNew."' WHERE ID='".$idTestoSelezionato."'");
echo ("UPDATE Argomenti_".$_SESSION[sessioneMateria]." SET Testo='testo' WHERE ID='".$idTestoSelezionato."'");
}
?>
<form name="form" method="post" action="<?php echo $PHP_SELF;?>">
<textarea id="textAreaTesto" name="textAreaTesto" cols=50 rows=30><?php echo $TestoSelezionato;?></textarea>
<input type="submit" name="NewText" class='btn' value="invia testo">
</form>
</div>
You can (and should) take advantage of prepared statements:
Please note that if
$_SESSION['sessioneMateria']is populated with a user submitted value, you should sanitize it (i.e. make sure it only contains alphabets, etc.).