Hi all... I've been reading this site for a while and now I have a question for you experts.
I have a php page named edit.php. Code here:
<?
// Connect database.
include("connectdb.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'];
$date_entered=$_POST['date_entered'];
$date_completed=$_POST['date_completed'];
$location=$_POST['location'];
$person_reporting=$_POST['person_reporting'];
$solution=$_POST['solution'];
// Do update statement.
mysql_query("update greenslip set date_completed='$date_completed', location='$location', person_reporting='$person_reporting', solution='$solution' where id='$id'");
exit;
}
// ************* End update part *************
// *** Select data to show on text fields in form. ***
// Get id parameter (GET method) from select.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 greenslip 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>
<head>
<script language="javascript" src="choosedate.js"></script>
<link rel="stylesheet" type="text/css" href="main.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>New Greenslip</title>
</head>
<body>
<!-- Begin Wrapper -->
<div id="wrapper">
<!-- Begin Header -->
<div id="header">
Green Slip application
</div>
<!-- End Header -->
<!-- Begin Navigation -->
<div id="navigation">
<a href="insert.htm">New Slip</a> <a href = "openslips.php">Open Slips</a> Edit Slips <a href="closeslip.php">Close Slips</a>TESTING
</div>
<!-- End Navigation -->
<!-- Begin Content -->
<? echo $row['id']; ?>
<form id="form1" name="form1" method="post" action="openslips.php">
<p>Date Entered :
<!-- name of this field is "date entered" -->
<? echo $_row['date_entered']; ?>
<br />
Date Completed :
<!-- name of this text field is "date completed" -->
<input name="date_completed" type="text" id="date_completed" value="<? echo $row['date_completed']; ?>"/>
<br />
Location :
<!-- name of this text field is "location" -->
<input name="location" type="text" id="location" value="<? echo $row['location']; ?>"/>
<br />
Person Reporting :
<!-- name of this text field is "person reporting" -->
<input name="person_reporting" type="text" id="person_reporting" value="<? echo $row['person_reporting']; ?>"/>
Solution :
<!-- name of this text field is "solution" -->
<input name="solution" type="text" id="solution" value="<? echo $row['solution']; ?>"/>
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>
<!-- end Content -->
</div>
</body>
</html>
For the life of me I can't seem to get this thing to update. I'm sure I'm missing something... Can anyone help??
Thanks,
Sean