UPDATE does not update table

-1

I'm not able to update my fields. Where am I going wrong?

I get the id through GET and I can display the data in the table, but I can not update it.

FIELDS

$id_destino = $_GET['id_destino'];
$destino = mysql_real_escape_string($_POST['destino']);
$historia = mysql_real_escape_string($_POST['historia']);
$geografia = mysql_real_escape_string($_POST['geografia']);
$clima = mysql_real_escape_string($_POST['clima']);
$cultura   = mysql_real_escape_string($_POST['cultura']);

if($_POST['enviar']) {
    $sql = mysql_query("UPDATE 'destinos_pt' SET destino = '$destino', historia = '$historia', geografia = '$geografia', clima = '$clima', cultura = '$cultura'  WHERE id_destino = '$id_destino'");
    header("Location: dashboard.php");
}

FORM

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" name="destinosform" novalidate role="form">
</form>

What's wrong that I can not update my table ?

    
asked by anonymous 26.04.2014 / 00:42

1 answer

1

From what I've noticed, $ _GET ['target_id']; is not being set. Do this and check if there is any value being returned: var_dump($_GET['id_destino']);

If it is empty, you should (if you really want to use this mix of GET and POST, but do not recommend) send the id inside the action of your form.

And $_POST['enviar'] ? Does it exist inside your form? If it does not exist, the condition will not be satisfied and the UPDATE will not be executed.

    
06.05.2014 / 06:42