0

i would like to do a script something like this:

    <script>
    function termektorol(kod)
    {
    <?php $parancs="delete from mex_telefon where id='?>kod<?php'";
    if(mysql_query($parancs))
    {
    ?> alert (kod); <?php
    } ?>}
    </script>

If i replace the 'kod' with just an actual id it deletes the thing,but i cant get it to work with the 'kod' from the function.I think its only synthax error,but i dont know how to fix it.

Broccholio
  • 63
  • 1
  • 7

1 Answers1

-1

A possible solution is to reload page and add this parametre to the request

window.location = ...var='+kod

and in php

<?php 
$parancs="delete from mex_telefon where id='.$_REQUEST["var"].'";
?>

Other solution is to use AJAX : send request from Javascript to PHP

FrancoisT
  • 31
  • 7