html - Update or delete SQL row based on radio button selection PHP -


i'm trying update/delete sql row based on value of radio button using php.

my code looks below , far, when click submit button - nothing!

<form method="post" action="?action">   <?php   $stmt = $pdo->query('select * reviews approved="0" order id desc');    while ($result= $stmt->fetch(pdo::fetch_assoc)) {    $reviewtitle= $result['title'];   $rating= $result['rating'];   $name= $result['name'];   $date= $result['date'];   $review= $result['review'];   $id= $result['id'];   $counter = ++$counter;   ?>    <br>   <?php echo $reviewtitle; ?><br>   <?php echo $rating; ?>   <br>   <?php echo $name; ?><br>   <?php echo $review; ?>   <p>posted: <?php echo $date; ?></p>   <p>review id: <input type="text" name="idnumbers[<?php echo $count; ?>]" value="<?php echo $id; ?>" readonly></p>      <input type="radio" name="approved[<?php echo $count; ?>]" value="approve review"> approve review<br>     <input type="radio" name="approved[<?php echo $count; ?>]" value="delete review"> delete review<br>    </div>   <br>   <?php } ?>   <br>   <br>   <input type="submit" value="submit"> </form> 

-

<?php     $currentid = "";     if (isset($_get['action'])) {         $count2 = $counter;         while ($count2 > "0"){         $currentid = $_post["idnumbers[".$count2."]"];               if ($_post["approved[".$count2."]"] = "approve review") {                     $stmt = $pdo->prepare("update reviews set approved='1' (id=?)");                     $stmt->execute(array($currentid));             } elseif ($_post["approved[".$count2."]"] = "delete review") {                     $stmt = $pdo->prepare("delete reviews (id=?)");                     $stmt->execute(array($currentid));             }             $count2 = --$count2;         }         echo "<h2> successful!</h2>";     } ?> 

there other bits of code in however, seems button nothing @ moment , i'm not sure why. new php, go easy please :)

if can see going go wrong in other ways, please let me know haven't been able test yet button won't work.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -