Jump to content

Another Error


Joshua F

Recommended Posts

Error

Notice: Undefined index: action in C:\Users\cory\Desktop\xampp\htdocs\Starter Kit(2)\admincp\pages\news.php on line 69

 

Php code

<?php
if($_GET['action'] == 'delete') {
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
mysql_query("DELETE FROM blog WHERE ID = '". realEscape($_POST['ID']) ."';") or die(mysql_error());
echo "News Deleted";
}
}
?>
<?php
$result1 = mysql_query("SELECT * FROM blog ORDER BY ID desc") or die (mysql_error());
while($result = mysql_fetch_assoc($result1)) {
?><center>
<h1>Delete News</h1>
<form action="news.php?action=delete" method="POST">
ID:
<select name="id" id="id">
	<option value="<?php echo $result['ID'];?>"><?php echo $result['ID'];?> - <?php echo $result['name'];?></option>
</select>
<input type="submit" name="submit" value="Delete News">
</form></center>
<?php } ?>

 

Any ideas?

Link to comment
Share on other sites

My current code:

<?php
if ($_GET['action'] == ('delete')) {
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
mysql_query("DELETE FROM blog WHERE ID = '". realEscape($_POST['ID']) ."';") or die(mysql_error());
echo "News Deleted";
}
}
?>
<?php
$result1 = mysql_query("SELECT * FROM blog ORDER BY ID desc") or die (mysql_error());
while($result = mysql_fetch_assoc($result1)) {
?><center>
<h1>Delete News</h1>
<form action="news.php?action=delete" method="POST">
ID:
<select name="id" id="id">
	<option value="<?php echo $result['ID'];?>"><?php echo $result['ID'];?> - <?php echo $result['name'];?></option>
</select>
<input type="submit" name="submit" value="Delete News">
</form></center>
<?php } ?>

 

Error:

Notice: Undefined index: action in C:\Users\cory\Desktop\xampp\htdocs\Starter Kit(2)\admincp\pages\news.php on line 69

Line 69 :

if ($_GET['action'] == ('delete')) {

i added the isset and it show another error..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.