martywire
asked on
Spot The Errors And Help Me!
Hi Everyone!
it's been well over 5 months since I last developed a ColdFusion site and I'm slowly getting back into it.
I have some errors that are dragging me down and it's late and i'm tired and I cannot for the life of me find out where they are. After pressing the 'submit' button i get a HTTP500 error and the page is not displayed due to a server error.
Im not sure if its an error with my action page or with my form page. The database I am using is a Microsoft access one!
HELP!! Once i get this going then I will be on my way!
Here is my code:
(addnewadvert.cfm)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Add New Advertisement</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p><strong>ADD NEW ADVERTISEMENT</strong></p>
<CFFORM ACTION="processadvert.cfm" METHOD="post">
<table width="465" border="1">
<tr>
<td width="96">Name</td>
<td width="353"><cfinput type="text" required="yes" name="username" size="20" validate="REGULAR_EXPRESSI ON" pattern="[A-Za-z0-9]" message="Please enter User Name"></td>
</tr>
<tr>
<td>Email</td>
<td><cfinput type="text" required="yes" name="email" size="20" validate="REGULAR_EXPRESSI ON" pattern="[A-Za-z0-9]" message="Please enter email"> </td>
</tr>
<tr>
<td>Date Added</td>
<td><cfinput type="text" name="current_date" value="#DateFormat(now(), 'dd/mm/yyyy')#"></td>
</tr>
<tr>
<td>Expiry Date </td>
<cfoutput>
<td><select name="expiry_date">
<option value="#DateFormat(DateAdd ("d", 7, now()), 'dd/mm/yyyy')#">
#DateFormat(DateAdd("d", 7, now()), 'dd/mm/yyyy')#
</option>
<option value="#DateFormat(DateAdd ("d", 14, now()), 'dd/mm/yyyy')#">
#DateFormat(DateAdd("d", 14, now()), 'dd/mm/yyyy')#
</option>
</select></td></cfoutput>
</tr>
<tr>
<td>Ad Details </td>
<td><textarea rows="3" cols="30"></textarea></td>
</tr>
</table>
<INPUT TYPE="submit" VALUE="Submit Advert">
</cfform>
<p> </p>
</body>
</html>
(processadvert.cfm)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Add New Advert Process Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<CFPARAM NAME="Form.username" DEFAULT="">
<CFPARAM NAME="Form.email" DEFAULT="">
<CFPARAM NAME="Form.current_date" DEFAULT="">
<CFPARAM NAME="Form.expiry_date" DEFAULT="">
<cfparam name="form.advertdetails" default="">
<CFQUERY NAME="qInsAdvert" DATASOURCE="advertisements ">
INSERT INTO ads(SellerName,EmailAddres s,
DateEntered,ExpiryDate,adv ertisement contents)
VALUES('#FORM.username#',
'#FORM.email#',
'#FORM.currentdate#','#FOR M.expiry_d ate#','#FO RM.advertd etails#')
</CFQUERY>
<cflocation url="addnewadvert.cfm">
</body>
</html>
it's been well over 5 months since I last developed a ColdFusion site and I'm slowly getting back into it.
I have some errors that are dragging me down and it's late and i'm tired and I cannot for the life of me find out where they are. After pressing the 'submit' button i get a HTTP500 error and the page is not displayed due to a server error.
Im not sure if its an error with my action page or with my form page. The database I am using is a Microsoft access one!
HELP!! Once i get this going then I will be on my way!
Here is my code:
(addnewadvert.cfm)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Add New Advertisement</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p><strong>ADD NEW ADVERTISEMENT</strong></p>
<CFFORM ACTION="processadvert.cfm"
<table width="465" border="1">
<tr>
<td width="96">Name</td>
<td width="353"><cfinput type="text" required="yes" name="username" size="20" validate="REGULAR_EXPRESSI
</tr>
<tr>
<td>Email</td>
<td><cfinput type="text" required="yes" name="email" size="20" validate="REGULAR_EXPRESSI
</tr>
<tr>
<td>Date Added</td>
<td><cfinput type="text" name="current_date" value="#DateFormat(now(), 'dd/mm/yyyy')#"></td>
</tr>
<tr>
<td>Expiry Date </td>
<cfoutput>
<td><select name="expiry_date">
<option value="#DateFormat(DateAdd
#DateFormat(DateAdd("d", 7, now()), 'dd/mm/yyyy')#
</option>
<option value="#DateFormat(DateAdd
#DateFormat(DateAdd("d", 14, now()), 'dd/mm/yyyy')#
</option>
</select></td></cfoutput>
</tr>
<tr>
<td>Ad Details </td>
<td><textarea rows="3" cols="30"></textarea></td>
</tr>
</table>
<INPUT TYPE="submit" VALUE="Submit Advert">
</cfform>
<p> </p>
</body>
</html>
(processadvert.cfm)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Add New Advert Process Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<CFPARAM NAME="Form.username" DEFAULT="">
<CFPARAM NAME="Form.email" DEFAULT="">
<CFPARAM NAME="Form.current_date" DEFAULT="">
<CFPARAM NAME="Form.expiry_date" DEFAULT="">
<cfparam name="form.advertdetails" default="">
<CFQUERY NAME="qInsAdvert" DATASOURCE="advertisements
INSERT INTO ads(SellerName,EmailAddres
DateEntered,ExpiryDate,adv
VALUES('#FORM.username#',
'#FORM.email#',
'#FORM.currentdate#','#FOR
</CFQUERY>
<cflocation url="addnewadvert.cfm">
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the browser setting changing tip! I can now see what the error is in the coldfusion code and I have fixed it accordingly and it is going beautifully.
Just another query - I have a 'textarea' field:
<textarea rows="3" cols="30"></textarea>
where the user can write a description and when the submit button is pressed all the other data entered into the other text boxes is loaded into the database except for what is in the textarea box.
Does anyone have any ideas as to why the stuff in the textarea box is not being loaded into the database? I tried giving the textarea a name and that made no difference
Just another query - I have a 'textarea' field:
<textarea rows="3" cols="30"></textarea>
where the user can write a description and when the submit button is pressed all the other data entered into the other text boxes is loaded into the database except for what is in the textarea box.
Does anyone have any ideas as to why the stuff in the textarea box is not being loaded into the database? I tried giving the textarea a name and that made no difference
whats the new insert code?
you need to give it a name, else you can't refer to it in the action page:
form page:
<textarea name="myArea" rows="3" cols="30"></textarea>
action page:
INSERT INTO myTable (myColumn)
VALUES ('#form.myArea#')
HTH,
Chris
form page:
<textarea name="myArea" rows="3" cols="30"></textarea>
action page:
INSERT INTO myTable (myColumn)
VALUES ('#form.myArea#')
HTH,
Chris
in IE under tools|intenet options
select the advanced tab and make sure the show friendly http errors is not checked, im had a similar problem and there was no error in the code but i kept getting the 500 error, making this chenge fixed it, no idea why it happens you would need to ask M$