# \[php\]Editing records with forms!

**URL:** <https://forum.kirupa.com/t/php-editing-records-with-forms/207851>\
**Category:** programming\
**Created:** [November 22, 2006, 3:21am UTC](https://forum.kirupa.com/t/php-editing-records-with-forms/207851 "2006-11-22T03:21:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexGM16](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@AlexGM16](https://forum.kirupa.com/u/AlexGM16)\
**Post date:** [November 22, 2006, 3:21am UTC](https://forum.kirupa.com/t/php-editing-records-with-forms/207851/1 "2006-11-22T03:21:17Z")

</div>

Basically i have an administration page where it lists the records and has an edit link next to my record. When i click the link i want it to go to edit.php?id=‘whatever’…and it does. But I get internal server error everytime I click on it…please help:)

editnews.php:

```auto
<?php
if($_POST['submit']) { 
$id=$_GET['id'];
$db=mysql_connect("localhost", "user", "pass") or die("Could not connect to localhost"); 
mysql_select_db("alex", $db) or die("Could not find database alex");
$querySQL = mysql_query("UPDATE news SET postdate=CURDATE(), title='".$_POST['title']."', '".$_POST['newstext']."', WHERE id='$id'") or die(mysql_error());
header("Location: managenews.php");
} else {
?>
<form name="editNews" method="post"
action="<? $_SERVER['PHP_SELF']; ?>">
<input type="text" name="title" size="20" /><br /> 
<input type="text" name="newstext" size="20" />
<input type="submit" name="submit" value="submit" />
</form>
<? } ?> 

```
