Probleem is dat ik het niet werkend krijg. de fout heb ik na enkele uren nog niet gevonden.
Dit is de case:
van op een overzicht pagina selecteer ik een record (met id) en stuur dit naar mijn update pagina.
op de update pagina worden de juiste gegevens getoond.
na aanpassen van de gegevens druk ik op de submit knop en dan gaat mijn scherm leeg.
het record werd eveneens niet aangepast als ik terug naar de tabellen kijk.
kan iemand mij verder op weg helpen?
alvast bedankt!!
Dit is de code:
<meta http-equiv="Refresh" content="300">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<?php
// START PHP CODES. THIS PART MUST ON THE TOP OF THIS PAGE.
// Connect database.
include("connect.php");
// ***** This part will process when you Click on "Submit" button *****
// Check, if you clicked "Submit" button
if($_POST['Submit']){
// Get parameters from form.
$id=$_POST['id'];
$Catnr=$_POST['Catnr'];
$geleider=$_POST['geleider'];
$naamhond=$_POST['naamhond'];
$land=$_POST['land'];
$A=$_POST['A'];
$B=$_POST['B'];
$C=$_POST['C'];
$Tot=$_POST['Tot'];
$DK=$_POST['DK'];
$Hurt=$_POST['Hurt'];
// Do update statement.
mysql_query("update Registrations_IPO set A='$A', B='$B', C='$C',Tot='$Tot', DK='$DK' Hurt='$Hurt' where id='$id'");
// Re-direct this page to ipo_voor_update.php.
header("location:ipo_voor_update.php");
exit;
}
// ************* End update part *************
// *** Select data to show on text fields in form. ***
// Get id parameter (GET method) from ipo_voor_update.php
$id=$_GET['id'];
// Get records in all columns from table where column id equal in $id and put it in $result.
$result=mysql_query("select * from Registrations_IPO where id='$id'");
// Split records in $result by table rows and put them in $row.
$row=mysql_fetch_assoc($result);
// Close database connection.
mysql_close();
?>
<!-- END OF PHP CODES AND START HTML TAGS -->
<html>
<body>
<!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->
<form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>">
<p>Catnr.
<!-- name of this text field is "Catnr" -->
<input name="Catnr" type="text" id="Catnr" value="<? echo $row['Catnr']; ?>"/>
<br /><br />
Geleider:
<!-- name of this text field is "geleider" -->
<input name="geleider" type="text" id="geleider" value="<? echo $row['geleider']; ?>"/>
<br /><br />
Naam hond:
<!-- name of this text field is "naamhond" -->
<input name="naamhond" type="text" id="naamhond" value="<? echo $row['naamhond']; ?>"/>
<br /><br />
Land:
<!-- name of this text field is "lad" -->
<input name="land" type="text" id="land" value="<? echo $row['land']; ?>"/>
<br /><br />
A:
<!-- name of this text field is "A" -->
<input name="A" type="text" id="A" value="<? echo $row['A']; ?>"/>
<br /><br />
B:
<!-- name of this text field is "B" -->
<input name="B" type="text" id="B" value="<? echo $row['B']; ?>"/>
<br /><br />
C:
<!-- name of this text field is "C" -->
<input name="C" type="text" id="C" value="<? echo $row['C']; ?>"/>
<br /><br />
Tot:
<!-- name of this text field is "Tot" -->
<input name="Tot" type="text" id="Tot" value="<? echo $row['Tot']; ?>"/>
<br /><br />
DK:
<!-- name of this text field is "DK" -->
<input name="DK" type="text" id="DK" value="<? echo $row['DK']; ?>"/>
<br /><br />
Hurt:
<!-- name of this text field is "Hurt" -->
<input name="Hurt" type="text" id="Hurt" value="<? echo $row['Hurt']; ?>"/>
<br /><br />
<input type="submit" name="Submit" value="Submit" />
<br />
</form>
</body>
</html>