0
I want to get the value I’m gonna write on my textbox
. All on the same page to then change a table field by the value inserted in textbox
.
<form method="POST" action="#">
<input type=text required name='txtnewpass' autofocus style='width:150px' value='<?php echo "$txtnewpass"; ?>'>
<input type=submit name=Alterar value=Alterar>
</form>
PHP
if ($_POST['txtnewpass']){
$txtnewpass = $_POST['txtnewpass'];
}
$base_hndl = new SQLite3($dir.$base);
$requete = "UPDATE 'users' SET
password='$txtnewpass'
WHERE login='$login'";
$resultat = $base_hndl->exec($requete);
echo "<br><b><center>password change</center></b>";
What is the Undefined index problem? it would be nice to put an isset() in if.
– rray
Yes that’s the mistake.
– akm
probably the stick you’re giving is a generic PHP warning, which you can resolve by changing the configs of php.ini, reads this: http://stackoverflow.com/questions/15949304/turn-off-display-error-php-ini
– MarceloBoni
I changed the if to if (isset($_POST['txtnewpass']))
– akm
The code works, but it always gives me the Undefined error
– akm