I have the following code:
[code=php]<?php
if(isset($select)&&$select!=””){
$select=$_GET[‘select’];
}
?>
<form id=”form1″ name=”form1″ method=”get” action=”<? echo $PHP_SELF; ?> “>
Select Councillor :
<select name=”select”>
<option value=””>— Select —</option>
<?php
// Get records from database (table “name_list”).
$list=mysql_query(“select * from members order by firstname asc”);
// Show records by while loop.
while($row_list=mysql_fetch_assoc($list)){
?>
<option value=”<? echo $row_list[‘id’]; ?>” <? if($row_list[‘id’]==$select){ echo “selected”; } ?>><? echo $row_list[‘id’]; ?> <? echo $row_list[‘firstname’]; ?> <?php echo $row_list[‘surname’]; ?> – <? echo $row_list[‘ward’]; ?></option>
<?php
// End while loop.
}
?>
</select>
<input type=”submit” name=”Submit” value=”Select” />
</form>
<hr>
<p>
<?php
// If you have selected from list box.
if(isset($select)&&$select!=””){
// Get records from database (table “name_list”).
$result=mysql_query(“select * from mebers where id=’$select'”);
$row=mysql_fetch_assoc($result);
?>
Are you sure you would you like to delete <? echo $row[‘firstname’]; ?> <? echo $row[‘surname’]; ?> from the Database?</p>
<?php
// End if statement.
}
?>
The drop down box is working fine, displaying all the data it should be, but when i select an item from the dropdown and click submit this bit:
[code=php]<?php
// If you have selected from list box.
if(isset($select)&&$select!=””){
// Get records from database (table “name_list”).
$result=mysql_query(“select * from mebers where id=’$select'”);
$row=mysql_fetch_assoc($result);
?>
Are you sure you would you like to delete <? echo $row[‘firstname’]; ?> <? echo $row[‘surname’]; ?> from the Database?</p>
doesnt work, it just completely skips the PHP and just displays:
“Are you sure you would you like to delete from the Database?”
instead of:
“Are you sure you would you like to delete [B]Firstname lastname
Cheers,
Dan