Well, first this:
while ($vis = mysql_fetch_array($hent)){
$overskrift = $vis['side_overskrift'];
}
Is totally redundant since:
- You select ALL rows from forside
- In a loop through those rows you read the field into $overskrift replacing the last loaded value
- With the next line you overwrite that with the contents of $_POST:
$overskrift = $_POST['side_overskrift'];
This script should update my database, but it does not. Whats wrong? I dont need to know how the form actions work.
Well, you do need to know how the form actions work. You see, when you first call your script, the $POST['side_overscrift'] does not exist. Actually, since you do not set the action of your script, you can call it as many times as you want, the $POST key will not exist.
If you set the action to same script, then on submit, the script will be called and $_POST['side_overskrift'] will contain the contents of the form element with the name "side_overskrift", in your case, the textarea element.
PHP is server side, it runs, does something, and outputs something to the client. After you load the page, there is no more PHP in the story.