php - Beginner trouble updating records PDO -
i have read lot of articles/blogs cannot find wrong. trying update records using pdo
when press send nothing happens, no error, , not work.
php:
$stmt = $conn->prepare('update products set name = :name id = :id'); $stmt->bindvalue(':id', $_post['id'], pdo::param_int); $stmt->bindvalue(':name', $_post['name'], pdo::param_str); $stmt->execute();
html:
<form name="prodform" class="pure-form pure-form-aligned" method="post"> <input name="name" type="text" value="<?php echo $data['nome']; ?>"> <input name="id" type="hidden" value="<?php echo $data['id']; ?>"> <input name="send" type="submit" value="send"> </form>
it seems found way make work don't know why works this. changed input name different 1 , worked magic, don't know why if use:value="<?php echo $data['name'];?>" name="name"
doesn't work if this: value="<?php echo $data['name'];?>" name="anyname"
works.
Comments
Post a Comment