I’ve got a function which sends the “id” value to a php file but all it’s send is null.. can anyone spot why?
(the value of id is not null)
function send(point, name, message, type, file, id, lat, lng) {
var html = "<b>" + name + "</b> <br/>" + message + '<IMG SRC=\"'+file+'\">' + ' <br> id = ' + id + "<a href=delete.php?id="+ <?php echo "\"".$nt['id']."\""?> +">Delete Entry</a>";
}
you appear to use a javascript argument
idand php variable$nt['id']in your code, I’d assume you either need to use one or the other – logic dictates that if the js argumentidis not null then you use that, if the PHP variable$nt['id']is not null then use that.If they are both null then you need to be checking more of the script that just this little snippet 🙂
or
may also be worth pointing out you really shouldn’t be using GET params for a script such as ‘delete.php’ – what happens if they have a link checker, anti virus, or internet speeder which pre requests links? and technically, GET is a ‘safe’ HTTP method (a client should expect no action to be taken and no change to any resources to be made in response to a gET on an URL).