HTML beginner |
|
<?
$id = (int) $_GET["id"];
if ( !empty ( $_POST["submit"] ) ) {
$query = "UPDATE `tabel` SET `veld1` = '%s', `veld2` = '%s' WHERE id = %d";
mysql_query( sprintf( $query, $_POST["veld1"], $_POST["veld2"], $id ) );
} else {
echo '<form id="form1" method="post" action="xx">';
$query = "SELECT `veld1`, `veld1` FROM `tabel` WHERE id = %d";
$result = mysql_query ( sprintf ( $query, $id ) );
while ( $row = mysql_fetch_array($result, MYSQL_ASSOC) ) {
echo '<input type="text" name="veld1" value="'.$row["veld1"].'" />';
echo '<input type="text" name="veld2" value="'.$row["veld2"].'" />';
}
echo '<input type="submit" name="submit" />'
echo '</form>'
}
?>
<? $id = (int) $_GET["id"]; if ( !empty ( $_POST["submit"] ) ) { $query = "UPDATE `tabel` SET `veld1` = '%s', `veld2` = '%s' WHERE id = %d"; } else { echo '<form id="form1" method="post" action="xx">'; $query = "SELECT `veld1`, `veld1` FROM `tabel` WHERE id = %d"; echo '<input type="text" name="veld1" value="'.$row["veld1"].'" />'; echo '<input type="text" name="veld2" value="'.$row["veld2"].'" />'; } echo '<input type="submit" name="submit" />' } ?>
Zoiets |