<?php

include('functions.php');
include('db.inc.php');

if($round) {

	while (list($key, $val) = each($_POST)) {
		if ($key<>"id" && $key<>"Submit" && $key<>"round"){
			$set.=$key ."='". addslashes($val) . "', ";
		}
	}

	$set=substr($set,0, strlen($set)-2);

	$stmt="UPDATE kk_upload SET $set WHERE id='$id'";

	$mydb = new db();
	$result=$mydb->query($stmt);
	header("Location:a_upload.php");

} else {

$title="szerkesztes";

	include('header.inc.php');

	$mydb = new db();

	$stmt="SELECT * FROM kk_upload WHERE id='$id'";

	$result=$mydb->query($stmt);

	printf("<H3>Szerkesztés</H3>");


	while($row = mysql_fetch_object($result)){

		for($field_index=0; $field_index<mysql_num_fields($result); $field_index++){
			$field_name=mysql_field_name($result, $field_index);
			$data[$field_name]=$row->$field_name;
		}

		generate_html_form('upload', $data, $PHP_SELF);
	}

	include('footer.inc.php');

}

?>
