Jump to content


ASP problem


4 replies to this topic

#1 xguy

    Young Padawan

  • Members
  • Pip
  • 9 posts

Posted 25 June 2006 - 12:48 PM

Hi, I need some help from you guys.

I coded a HTML page (entry.htm) with images, therefore I changed the file format to .asp (it's now entry.asp) because I added a iFrame in the page (entry.asp), this mean the iFrame will link to another .asp called insert.asp (that will allow me to type information then click a button to store data). In other words, the file (entry.asp) displays insert.asp of the iFrame.

everything works in Internet Explorer, but it doesn't work for Firefox (when I view entry.asp using Firefox, the page displays the HTML codes instead of the whole rendered page) :D

Thanks a lot.

Edited by xguy, 25 June 2006 - 12:50 PM.


#2 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 25 June 2006 - 01:12 PM

An example of this is always good :D

#3 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 25 June 2006 - 04:55 PM

View Post.Matt, on Jun 25 2006, 06:12 PM, said:

An example of this is always good :D
that an the source code. :P


unless that's what Matt meant. :D

#4 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 25 June 2006 - 04:59 PM

I meant a link to the page so there would be a source code lol. Since its unlikely to be a asp problem :D

#5 xguy

    Young Padawan

  • Members
  • Pip
  • 9 posts

Posted 25 June 2006 - 07:15 PM

Okay.. I will try my best.

Entry.asp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Welcome to Pablo!</title>
<style type="text/css">
<!--
body {
	background-color: #006633;
	margin-left: 0px;
	margin-right: 0px;
	margin-top: 0px;
	margin-bottom: 0px;
}
</style>
<link href="../Test/Test2/css/home.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
a:link {
	color: #000000;
	text-decoration: none;
	
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none; font-weight:Bold;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
}
.style3 {color: #003333}
-->
</style>

<script type="text/javascript">
function newImage(arg) {
	if (document.images ) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images ) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
// -->
</script>
</head>

<body>
<table id="Index" width="714" height="600" border="0" cellpadding="0" cellspacing="0">
	<tr valign="top">
		<td rowspan="3">
			<img src="images/Index_01.gif" width="23" height="600" alt=""></td>
		<td colspan="2">
			<img src="images/Index_02.gif" width="665" height="129" alt=""></td>
		<td rowspan="3">
			<img src="images/Index_03.gif" width="26" height="600" alt=""></td>
	</tr>
	<tr>
		<td colspan="2">
			<img src="images/Index_04.gif" width="665" height="30" alt=""></td>
	</tr>
		<td>
			<img src="images/contents.gif" name="contents" width="129" height="441" border="0" align="top" usemap="#buttons"></td>
	  <td width="536" height="441" valign="top" background="images/Index_06.gif">
	  <table width="100%"  border="0">
  <tr><td height="39">&nbsp;</td>
  </tr>
  <tr>
  <td height="345">
   <iframe 
src ="Insert.asp"
width="515"
height="345" frameborder="0" scrolling="yes"></iframe></td>
		</td>
  </tr>
</table>

	  </td>
	</tr>
</table>


<map name="buttons">
<area shape="poly" coords="20,53,35,36,78,82,64,99" HREF="Index.htm" 
				onmouseover="changeImages('contents', 'images/home_03-over.gif'); return true;"
				onmouseout="changeImages('contents', 'images/home_03-out.gif'); return true;"
				onmousedown="changeImages('contents', 'images/home_03-over.gif'); return true;"
				onmouseup="changeImages('contents', 'images/home_03-over.gif'); return true;">



<area shape="poly" coords="22,85,65,132,80,115,36,74" HREF="News.htm"
				onmouseover="changeImages('contents', 'images/news_03-over.gif'); return true;"
				onmouseout="changeImages('contents', 'images/news_03-out.gif'); return true;"
				onmousedown="changeImages('contents', 'images/news_03-over.gif'); return true;"
				onmouseup="changeImages('contents', 'images/news_03-over.gif'); return true;">
				


<area shape="poly" coords="21,123,30,104,97,168,84,186" HREF="Pictures.htm"
				onmouseover="changeImages('contents', 'images/pictures_03-over.gif'); return true;"
				onmouseout="changeImages('contents', 'images/pictures_03-out.gif'); return true;"
				onmousedown="changeImages('contents', 'images/pictures_03-over.gif'); return true;"
				onmouseup="changeImages('contents', 'images/pictures_03-over.gif'); return true;">
				


<area shape="poly" coords="19,157,73,208,84,193,24,133" HREF="videos.htm"
				onmouseover="changeImages('contents', 'images/videos_03-over.gif'); return true;"
				onmouseout="changeImages('contents', 'images/videos_03-out.gif'); return true;"
				onmousedown="changeImages('contents', 'images/videos_03-over.gif'); return true;"
				onmouseup="changeImages('contents', 'images/videos_03-over.gif'); return true;">
				




<area shape="poly" coords="15,184,78,247,95,232,26,171,26,171" HREF="forums.htm"
				onmouseover="changeImages('contents', 'images/forums_03-over.gif'); return true;"
				onmouseout="changeImages('contents', 'images/forums_03-out.gif'); return true;"
				onmousedown="changeImages('contents', 'images/forums_03-over.gif'); return true;"
				onmouseup="changeImages('contents', 'images/forums_03-over.gif'); return true;">
				

				
<area shape="poly" coords="18,221,20,197,100,274,84,291" HREF="contact.html"
				onmouseover="changeImages('contents', 'images/contact_03-over.gif'); return true;"
				onmouseout="changeImages('contents', 'images/contact_03-out.gif'); return true;"
				onmousedown="changeImages('contents', 'images/contact_03-over.gif'); return true;"
				onmouseup="changeImages('contents', 'images/contact_03-over.gif'); return true;">

</map>
</body>
</html>

Insert.asp

<!--#include file="Connections/Con1.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "form1") Then

  MM_editConnection = MM_Con1_STRING
  MM_editTable = "Guest"
  MM_editRedirectUrl = "Acknowledge.htm"
  MM_fieldsStr  = "FirstName|value|Surname|value|Comment|value|Email|value"
  MM_columnsStr = "FirstName|',none,''|Surname|',none,''|Comment|',none,''|Email|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
	MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
	If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
	  MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
	Else
	  MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
	End If
  End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
	MM_formVal = MM_fields(MM_i+1)
	MM_typeArray = Split(MM_columns(MM_i+1),",")
	MM_delim = MM_typeArray(0)
	If (MM_delim = "none") Then MM_delim = ""
	MM_altVal = MM_typeArray(1)
	If (MM_altVal = "none") Then MM_altVal = ""
	MM_emptyVal = MM_typeArray(2)
	If (MM_emptyVal = "none") Then MM_emptyVal = ""
	If (MM_formVal = "") Then
	  MM_formVal = MM_emptyVal
	Else
	  If (MM_altVal <> "") Then
		MM_formVal = MM_altVal
	  ElseIf (MM_delim = "'") Then  ' escape quotes
		MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
	  Else
		MM_formVal = MM_delim + MM_formVal + MM_delim
	  End If
	End If
	If (MM_i <> LBound(MM_fields)) Then
	  MM_tableValues = MM_tableValues & ","
	  MM_dbValues = MM_dbValues & ","
	End If
	MM_tableValues = MM_tableValues & MM_columns(MM_i)
	MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
	' execute the insert
	Set MM_editCmd = Server.CreateObject("ADODB.Command")
	MM_editCmd.ActiveConnection = MM_editConnection
	MM_editCmd.CommandText = MM_editQuery
	MM_editCmd.Execute
	MM_editCmd.ActiveConnection.Close

	If (MM_editRedirectUrl <> "") Then
	  Response.Redirect(MM_editRedirectUrl)
	End If
  End If

End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	background-color: #ADF6E8;
}
.style1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
}
-->
</style></head>

<body>
<form method="post" action="<%=MM_editAction%>" name="form1">
  <table align="center">
	<tr valign="baseline">
	  <td width="67" align="right" nowrap><span class="style1">FirstName:</span></td>
	  <td width="325"><input type="text" name="FirstName" value="" size="32">
	  </td>
	</tr>
	<tr valign="baseline">
	  <td align="right" nowrap class="style1">Surname:</td>
	  <td><input type="text" name="Surname" value="" size="32">
	  </td>
	</tr>
	<tr>
	  <td align="right" valign="top" nowrap class="style1">Comment:</td>
	  <td valign="baseline"><textarea name="Comment" cols="50" rows="5"></textarea>
	  </td>
	</tr>
	<tr valign="baseline">
	  <td align="right" nowrap class="style1">Email:</td>
	  <td><input type="text" name="Email" value="" size="32">
	  </td>
	</tr>
	<tr valign="baseline">
	  <td nowrap align="right">&nbsp;</td>
	  <td><input type="submit" value="Insert record">
	  </td>
	</tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
</body>
</html>






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users