Associate
- Joined
- 29 Jul 2005
- Posts
- 445
- Location
- Matlock
this has had me stumped for a while now, can't see where i've gone wrong
should be pretty self explanatory but currently i get an error:
Parse error: syntax error, unexpected T_ISSET, expecting '(' in removeclientscript.php on line 8
removeclient.php
and removeclientscript.php:
I guess it's failed to POST the data but can't see why, any help would be lovely
thanks
should be pretty self explanatory but currently i get an error:
Parse error: syntax error, unexpected T_ISSET, expecting '(' in removeclientscript.php on line 8
removeclient.php
PHP:
<form name="removeclientfrm" method="post" action="removeclientscript.php">
<table>
<tr>
<td>
Which client would you like to remove?
</td>
<td>
<select name="client">
<?php
////getting data for option buttons of form
////Connects to db
include 'library/config.php';
include 'library/opendb.php';
////Extra data from table
$sql = "SELECT client_id, client_forename, client_surname
FROM tbl_client";
$result = mysql_query($sql)
or die('Query failed. ' . mysql_error());
////keeps getting the next row until there is no more to get
while($row = mysql_fetch_array( $result )) {
echo "<option value=\"";
echo $row['client_id'] . "\">";
echo $row['client_id'] . " " ;
echo $row['client_forename'] . " ";
echo $row['client_surname'];
echo "</option>";
}
////disconnect from db
include 'library/closedb.php';
?>
</select>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Remove" />
</td>
</tr>
</table>
</form>
PHP:
<?php
session_start();
////Don't want users that aren't logged in running this script
include 'checklogin.php';
////this script should only be run by admins
include 'requireadmin.php';
////Check data has been sent from form
if isset($_POST['client']) {
////Enter values from form into variables
$clientid = $_POST['client'];
////Connect to DB
include 'library/config.php';
include 'library/opendb.php';
////Prepare SQL statement
$sql = "DELETE FROM tbl_client
WHERE client_id = $clientid";
////Perform the SQL ststement
$result = mysql_query($sql)
or die('Query failed. ' . mysql_error());
////Close DB connection
include 'library/closedb.php';
////go to index page
header('Location: index.php');
}
?>
I guess it's failed to POST the data but can't see why, any help would be lovely

thanks