-3
Hey, guys, I have a question.
I have a page from udpate
using the $_GET
to get the url, but in the update form I played the action in another folder, then at the time of doing the update does not recognize the ID, as it left the current page, as I can solve this, since it gave problem putting the code on the same page of the form, because only updated by clicking the button without filling. and also for code organization, follow update code
$ID = isset($_GET['ID']) ? $_GET['ID'] : '';
$titulo = isset($_POST['titulo']) ? $_POST['titulo'] : '';
$descricao = isset($_POST['descricao']) ? $_POST['descricao'] : '';
$alt = isset($_POST['alt']) ? $_POST['alt'] : '';
$bd->query("UPDATE tortas SET titulo = '$titulo', descricao = '$descricao', alt = '$alt' WHERE ID = '$ID'");
You can pass the ID on an input of type Hidden, so you will be able to catch it on the other page using the global variable
$_POST['id']
– Kayo Bruno
In the PHP file that has the form, you have to send the data to the new PHP where you have the SQL statement, I make me understand?
– White
Leaves on the same page of the form and puts the UPDATE inside a
if
checking that the variables are full.– Sam