<?php
include_once('dbconnect.php');
$sqlPAQuery = "SELECT pages.pageId, pages.pageTitle FROM pages order by
pages.pageId";
$paqueryResult = mysqli_query($conn,$sqlPAQuery);
echo "<form action = 'delete.php' method = 'post'>";
while ($paqueryRow = mysqli_fetch_assoc($paqueryResult))
{
echo "<input type = 'radio' name = '$paqueryRow[pageId]'>".$paqueryRow['pageTitle']." ";
echo "<input name='Submit' type='submit' value='delete record' /><br/>";
// FIND ALL ARTICLES FOR THIS PAGE
$sqlARTICLEQuery = "SELECT * FROM articles where pageId=$paqueryRow[pageId] order by articleId";
$articlequeryResult = mysqli_query($conn,$sqlARTICLEQuery);
while ($articlequeryRow = mysqli_fetch_assoc($articlequeryResult))
{
echo "<input type = 'radio' name = '$articlequeryRow[articleId]' method = 'post'>".$articlequeryRow['articleTitle']." ";
echo "<input name='Submit' type='submit' value='delete record' /><br/>";
// VIDEOS FOR EACH ARTICLE
$sqlVIDEOQuery = "SELECT * FROM videos where articleId=$articlequeryRow[articleId] order by videoId";
$videoqueryResult = mysqli_query($conn,$sqlVIDEOQuery);
while ($videoqueryRow = mysqli_fetch_assoc($videoqueryResult))
{
echo "<input type = 'radio' name = '$videoqueryRow[videoId]' method = 'post'>" . $videoqueryRow['videoTitle'] . " ";// . $videoqueryRow['videoLoc']." ";
echo "<input name='Submit' type='submit' value='delete record' /><br/>";
//echo"</br>";
}
// IMAGE FOR EACH ARTICLE
$sqlIMAGEQuery = "SELECT * FROM images where articleId=$articlequeryRow[articleId] order by imageId";
$imagequeryResult = mysqli_query($conn,$sqlIMAGEQuery);
while ($imagequeryRow = mysqli_fetch_assoc($imagequeryResult))
{
echo "<input type = 'radio' name = '$imagequeryRow[imageId]' method = 'post'>".$imagequeryRow['imageTitle'] . " "; //" . $imagequeryRow['imageLoc']." ";
echo "<input name='Submit' type='submit' value='delete record' /><br/>";
//echo"</br>";
}
*// TEXT FOR EACH ARTICLE
$sqlTEXTQuery = "SELECT * FROM text where articleId=$articlequeryRow[articleId] order by textId";
$textqueryResult = mysqli_query($conn,$sqlTEXTQuery);
while ($textqueryRow = mysqli_fetch_assoc($textqueryResult))
{
echo "<input type = 'radio' name = '$textqueryRow[textId]' method = 'post'>".$textqueryRow['textTitle']." ";
echo "<input name='Submit' type='submit' value='delete record' /><br/>";
if (isset($_POST['textDeleteQuery'])){
$name = $_POST[$textqueryRow['textId']];
$textDeleteQuery = "DELETE FROM text where articleId=$articlequeryRow[articleId] AND textId = ".$_POST[textDeleteQuery['textId']]."";
if(mysqli_query($conn, $textDeleteQuery)){
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . $conn->error;
}
}
}*
echo "<br/>";
}
echo "<br/>";
}
echo "</form>";
$conn->close();
?>
cant get text to delete when I press the button nothing happens not sure what im doing wrong db is set up with pages, articles, images, video and text. columns for pages: pages.pageId, pages.pageTitle; columns for article: article.articleId, article.articleTitle, pages.pageId, image columns for videos: videos.videoId, videos.videoTitle, videos.videoLoc, article.articleId columns for images: images.imageId, images.imageTitle, images.imageLoc, article.articleId columns for text: text.textId, text.textTitle, text.textLoc, article.articleId