Forums
This topic is locked
problem with delete record and list/menu box
Posted 22 years ago
1
has voted
22 years ago Chris Terwijn posted:
Hello people, I have a little problem, pls take a look at this.//This is the query for index.cfm
<cfquery datasource="logboek" name="list">
SELECT logID
FROM logboek
ORDER BY logID
</cfquery>
//This is my index.cfm
<form name="FORM1" method="post" action="delete.cfm">
<table width="28%" border="0" cellpadding="3" cellspacing="1" bordercolor="##000000" bgcolor="##0066CC">
<tr>
<td bgcolor="##0066FF"><div align="left"><font color="##FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Verwijderen<font size="1">
</font></strong><font size="1">(kies een LogID om te verwijderen)</font></font></div></td>
</tr>
<tr>
<td bgcolor="##0066CC"><div align="center">
<table width="100%" border="0">
<tr>
<td width="32%"><div align="center"><select name="logID" id="logID">
<option value="">Maak een keuze <cfoutput query="list">
<option value="#logID#">#logID# </cfoutput> </select><strong></strong></div></td>
<td width="68%"><div align="center">
<input type="submit" name="Submit" value="Verwijderen">
</div></td>
</tr>
<tr>
<td colspan="2"><div align="left"><font color="##FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">let
op!! Gegevens zullen voorgoed verwijderd zijn.</font></div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</form>
//This is the delete.cfm query
cfquery datasource="logboek">
DELETE FROM logboek WHERE logID=#logID#
</cfquery>
Replies
Replied 22 years ago
22 years ago Dennis van Galen replied:
Hi Sinnah,
What appears to be the problem ? Your index.cfm submits a valid ID to the delete page and the delete page deletes fine, can you explain your problem some more ?
I used these pages:
//Index.cfm
<cfquery datasource="logboek" name="list">
SELECT logID
FROM logboek
ORDER BY logID
</cfquery>
<form name="FORM1" method="post" action="delete.cfm">
<table width="28%" border="0" cellpadding="3" cellspacing="1" bordercolor="##000000" bgcolor="##0066CC">
<tr>
<td bgcolor="##0066FF"><div align="left"><font color="##FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Verwijderen<font size="1">
</font></strong><font size="1">(kies een LogID om te verwijderen)</font></font></div></td>
</tr>
<tr>
<td bgcolor="##0066CC"><div align="center">
<table width="100%" border="0">
<tr>
<td width="32%"><div align="center"><select name="logID" id="logID">
<option value="">Maak een keuze <cfoutput query="list">
<option value="#logID#">#logID# </cfoutput> </select><strong></strong></div></td>
<td width="68%"><div align="center">
<input type="submit" name="Submit" value="Verwijderen">
</div></td>
</tr>
<tr>
<td colspan="2"><div align="left"><font color="##FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">let
op!! Gegevens zullen voorgoed verwijderd zijn.</font></div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</form>
//delete.cfm
<cfquery datasource="logboek">
DELETE FROM logboek WHERE logID=#logID#
</cfquery>
And I deleted 3 out of 5 testvalues i entered, so your code works fine. The only thing I can think of is that the page stays on the delete.cfm after the delete from database has run. Please let me know what exactly your problem is and i will take another look.
with regards,
Dennis van Galen
DMXzone Manager
dennis@dmxzone.com
Extension, Tutorial and FAQ's Manager
What appears to be the problem ? Your index.cfm submits a valid ID to the delete page and the delete page deletes fine, can you explain your problem some more ?
I used these pages:
//Index.cfm
<cfquery datasource="logboek" name="list">
SELECT logID
FROM logboek
ORDER BY logID
</cfquery>
<form name="FORM1" method="post" action="delete.cfm">
<table width="28%" border="0" cellpadding="3" cellspacing="1" bordercolor="##000000" bgcolor="##0066CC">
<tr>
<td bgcolor="##0066FF"><div align="left"><font color="##FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Verwijderen<font size="1">
</font></strong><font size="1">(kies een LogID om te verwijderen)</font></font></div></td>
</tr>
<tr>
<td bgcolor="##0066CC"><div align="center">
<table width="100%" border="0">
<tr>
<td width="32%"><div align="center"><select name="logID" id="logID">
<option value="">Maak een keuze <cfoutput query="list">
<option value="#logID#">#logID# </cfoutput> </select><strong></strong></div></td>
<td width="68%"><div align="center">
<input type="submit" name="Submit" value="Verwijderen">
</div></td>
</tr>
<tr>
<td colspan="2"><div align="left"><font color="##FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">let
op!! Gegevens zullen voorgoed verwijderd zijn.</font></div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</form>
//delete.cfm
<cfquery datasource="logboek">
DELETE FROM logboek WHERE logID=#logID#
</cfquery>
And I deleted 3 out of 5 testvalues i entered, so your code works fine. The only thing I can think of is that the page stays on the delete.cfm after the delete from database has run. Please let me know what exactly your problem is and i will take another look.
with regards,
Dennis van Galen
DMXzone Manager
dennis@dmxzone.com
Extension, Tutorial and FAQ's Manager