The form however gets repeated for each record in the same browser window.
What I want to do is change this so that 1 record appears for once instance of the form and then use a previous and next button (or links but would prefer buttons) to jump through record to record.
I realise that there is another post in this forum but its using MySQL and sounds like the guy is using more then PHP file I am not. How do I go about doing this? I understand I need a variable for the pages similar to the one in the other thread but err.. I'm lost.
Here is the script I use,
Code: Select all
<?php
//CONNECTION STRING
function db()
{
$dbuser = "";
$dbpass = "";
$dbname = "ordertest";
//CONNECTION StrING
$db_conn = odbc_connect($dbname, $dbuser, $dbpass)
or die ("UNABLE TO CONNECT TO DATABASE");
return $db_conn;
}//end function db
// Select all the records and assign them to the form variables
$sql = "SELECT * FROM tblmanorders";
$id = ($sqlї'orderID']);
$firm = ($sqlї'Firm']);
$contact = ($sqlї'Contact']);
$email = ($sqlї'Email']);
$address = ($sqlї'Address']);
$telephone = ($sqlї'Telephone']);
$postcode = ($sqlї'Postcode']);
// Create a record count
$sqlcount = "SELECT count(*) FROM tblmanorders";
// Default variable for this script/form interaction
$SCRIPT_NAME = "process_orders.php";
// Produce results and post to form for each row in the recordset
$result = odbc_exec(db(),$sql);
if ($myrow = odbc_fetch_array($result)) {
do
{
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="admincss.css">
<title>Process Orders</title>
</head>
<body>
<form method="post" action="<?php echo $SCRIPT_NAME; ?>?post=yes">
<table width="100%" class="type1">
<tr>
<td class="title" align="center">
Process Orders
</td>
</tr>
</table>
<table width="100%">
<tr>
<td>
<table width="100%" class="type2">
<tr>
<th colspan="4" align="left">
Contact Details
</th>
</tr>
<tr>
<td width="15%">
Firm:
</td>
<td width="37%">
<? $firm = $myrowї"Firm"]; ?>
<input name="firm" type="text" value="<?php echo $firm; ?>">
</td>
<td width="19%">
Contact:
</td>
<td width="29%">
<? $contact = $myrowї"Contact"]; ?>
<input name="contact" type="text" value="<?php echo $contact; ?>">
</td>
</tr>
<tr>
<td>
Email:
</td>
<td>
<? $email = $myrowї"Email"]; ?>
<input name="email" type="text" value="<?php echo $email; ?>">
</td>
<td>
Telephone:
</td>
<td>
<? $telephone = $myrowї"Telephone"]; ?>
<input name="telephone" type="text" value="<?php echo $telephone; ?>">
</td>
</tr>
<tr>
<td valign="top">
Address:
</td>
<td>
<? $address = $myrowї"Address"]; ?>
<textarea name="address" rows="4" cols="39"><?php echo $address; ?></textarea>
</td>
<td valign="top">
Postcode:
</td>
<td valign="top">
<? $postcode = $myrowї"Postcode"]; ?>
<input name="postcode" type="text" value="<?php echo $postcode; ?>">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" class="type1">
<tr>
<th colspan="2">
Controls & Options:
</th>
</tr>
<tr>
<td align="right">
<input name="previousAdm" type="submit" value="Previous"> <input name="nextAdm" type="submit" value="Next">
</td>
<td align="left">
<? $id = $myrowї"OrderID"];?>
<input type="hidden" value="<?php echo $id; ?>" name="OrderID">
</td>
</tr>
</table>
</form>
</body>
<?php
}
while ($myrow = odbc_fetch_array($result));
}
?>
</body>
</html>