I built this function in my html page:
<script type = "text/javascript">
function set() {
var type = 'test';
var status = 0;
var id = 2;
$.post("sys/class/buttonHandler.php"), { status: status};
}
</script>
that is triggered by this button:
<button type="button" onclick="set()" class="btn">Press here</button>
to reach this buttonHandler.php:
<?php
require 'class.global.php';
$type = 'test';
$status = $_POST['status'];
$id = 2;
set($type, $status, $id);
?>
that correctly executes this function in the class.global.php:
function set($type, $status, $id)
{
$result = mysql_query("UPDATE users SET $type = '$status' WHERE id = '$id'");
}
The problem is when I try to change the parameter that the javascript function passes or when I try to add the other two parameters, like this:
<script type = "text/javascript">
function set_profile() {
var type = 'test';
var status = 0;
var id = 2;
$.post("sys/class/admobButtonHandler.php"), { status: status, type: type, id: id};
}
</script>
<?php
require 'class.global.php';
$type = $_POST['type'];
$status = $_POST['status'];
$id = $_POST['id'];
setProfile($type, $status, $id);
?>
Nothing works anymore.. Is there any other way that I can make this work? Thanks
)at the end of your$.post()function, is this a mistake?