I need to send POST method and everything done in the same page. Basically I need to download file, when I download file I want to add +1 to copies_sold
field.
This is the query with form:
<form method="POST" action="/download?key=<?=$strKey;?>">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="submit" name="Submit1" onclick="location='/'">
</form>
<?php
if ( isset( $_POST['Submit1'] ) ){
$sth = $resDB->exec("UPDATE themes SET copies_sold = copies_sold + 1 WHERE id = '{$id}' LIMIT 1");
}
?>
Do I need here to use some ajax or something ?
0 comments:
Post a Comment