---
title: "Undefined index: action"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/192821-undefined-index-action"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "MHZ"
published: "2015-11-24T14:43:05.000Z"
updated: "2015-11-24T14:57:07.000Z"
replies: 1
views: 700
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/192821-undefined-index-action"
---

# Undefined index: action

## #1 — MHZ, 2015-11-24T14:43Z

Det blir 'Undefined index: action' om man går på 'sida.php' men fungerar på 'sida.php?action=edit' samt 'sida.php?action=delete'. Måste ha gjort nått galet med if strängen. Sidan borde väl bli helt tom bara på 'sida.php'?

```
<?php if ($_GET['action'] == "edit") { ?>

<tr>
<td>edit test</td>
</tr>

<?php 
}
if ($_GET['action'] == "delete") { 
?>

<tr>
<td>delete test</td>
</tr>

<?php 
} 
?>
```

Permalänk: https://www.webforum.nu/p/192821

## #2 — MHZ, 2015-11-24T14:57Z

Fick till det :)

```
<?php if((isset($_GET['action']) && $_GET['action'] == 'edit')) { ?>

<tr>
<td>edit test</td>
</tr>

<?php 
}
if((isset($_GET['action']) && $_GET['action'] == 'delete')) {
?>

<tr>
<td>delete test</td>
</tr>

<?php 
} 
?>
```

Permalänk: https://www.webforum.nu/p/2319030

---

Tråden på webben: https://www.webforum.nu/amne/php/192821-undefined-index-action
