-3

I try to put the links of data and delete function. i can get the links of values but the delete button does not work . How can i fix it? thanks

<table width='100%'>
<tr>
<td style='font-weight:bold;'>Yol</td>
<td width='10' style='font-weight:bold;'>:</td><td>Faz<?= $veri[5] ?> > 
 <?= $aciklamalar[0][5] ?> > <?= $aciklamalar[0][3] ?> > <?= $veri[1] ?> </td></tr>
<tr><td    style='font-weight:bold;'>Node Tipi</td><td style='font-weight:bold;'>:</td>
<td> <?= $veri[7] ?> </tr><tr><td style='font-weight:bold;'>Toplam Yön</td>
 <td  style='font-weight:bold;'>:</td><td><?= $toplamyonaciklama[0][0] ?></tr><tr>
 <td style='font-weight:bold;'>Görüntüler</td><td style='font-weight:bold;'>:</td>
 <td>
     <? foreach($sistemResimleri as $sistemResimleri2){
         echo "<a href='../phps/sistemGoruntuleme.php?resimLinki=".$sistemResimleri2[1]."&faz=".$veri[5]."&bolge=".$aciklamalar[0][5]."&il=".$aciklamalar[0][3]."&merkez=".$veri[1]." 'onclick='return hs.htmlExpand(this,{ ".$a.",".$b.", width: 700, height:500 })'>".$sistemResimleri2[1]." </a> <button  width: 50px; height: 50px; onclick='deleteFunction($sistemResimleri2[0])'>Delete</button> <br/>  ";
     }?></td></tr></table>

function deleteFunction($pic_id)
{

    $picid=x;
    $sql="delete sysrom where picId =$picid";
      $_SESSION["VT"]->doQuery($sql);  




}
leventkalay92
  • 573
  • 3
  • 11
  • 28

2 Answers2

2

Your code does not work because you're trying to mix a server-side language (PHP) with a client-side language (JS).

I suggest doing some research on the differences between serer-side and client-side languages to help you understand your issue.

Here's a decent place to start.

James Hill
  • 60,353
  • 20
  • 145
  • 161
1

Dont use variables in single quotes ... Better get them out or use {$variable} syntax in single quotes not variable value but $variable will be dumped in the html code.

(Tek tırnak içine alma sen en güzeli :) )

try this

echo "<a href='../phps/sistemGoruntuleme.php?resimLinki=".$sistemResimleri2[1]."&faz=".$veri[5]."&bolge=".$aciklamalar[0][5]."&il=".$aciklamalar[0][3]."&merkez=".$veri[1]." 'onclick='return hs.htmlExpand(this,{ ".$a.",".$b.", width: 700, height:500 })'>".$sistemResimleri2[1]." </a> <button  width: 50px; height: 50px; onclick='deleteFunction($sistemResimleri2[0])'>Delete</button> <br/>  "

to

echo "<a href='../phps/sistemGoruntuleme.php?resimLinki=".$sistemResimleri2[1]."&faz=".$veri[5]."&bolge=".$aciklamalar[0][5]."&il=".$aciklamalar[0][3]."&merkez=".$veri[1]." 'onclick='return hs.htmlExpand(this,{ ".$a.",".$b.", width: 700, height:500 })'>".$sistemResimleri2[1]." </a> <button  width: 50px; height: 50px; onclick='deleteFunction(".$sistemResimleri2[0].")'>Delete</button> <br/>  "
Erdinç Çorbacı
  • 1,187
  • 14
  • 17