We help IT Professionals succeed at work.

Problem updating Captivate results to database using coldfusion

mattphung
mattphung asked
on
839 Views
Last Modified: 2013-12-24
I created a quiz in captivate and would like to store results in a database.  I followed a tutorial to accomplish this task but it's giving me a database query error.   The code for the quiz with the java script is
:

<!-- saved from url=(0013)about:internet -->
<!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=utf-8">
<title>talkingtoparentsquiz</title>
<script type="text/javascript">
<!-- Begin
var gstrEmailTo = "";
var gstrEmailSubject = "";
var gstrEmailBody = "";
var myVar = 0;

function appendEmailBody(strBody)
{
      var temp_str = strBody;
      while(temp_str.indexOf("|") > -1)
      {
            temp_str = temp_str.substr(0,temp_str.indexOf("|")) + "\r" + temp_str.substr(temp_str.indexOf("|") + 1)
      }
      gstrEmailBody += temp_str + "\r";
}

function sendMail()
{

      // strip the word Core Data out of the results
      var stripCoreData = gstrEmailBody.replace("Core Data", "");
      // remove the double quotes
      var stripQuotes = stripCoreData;
      while(stripQuotes.indexOf("\"") !=-1){
      stripQuotes=stripQuotes.replace("\"", "");
      }
      // turn results into an array to access single items
      var results_array = stripQuotes.split(",");

      // assign variables
      var RawScore = results_array[7];
      var MaxScore = results_array[8];
      var MinScore = results_array[9];
      var Accuracy = RawScore/MaxScore;
      Accuracy = Accuracy*100;

// write html for popup window
var htmlString=
"<html><head><title>Email Results</title></head><body>" +
"<form Name='results' method='post' action='insert.cfm'>" +
"<table cellspacing=1 cellpadding=4 border=0><tr><td bgcolor='#336699'><strong>Your score:</strong></td>" +
"<td align='left' bgcolor='#6699cc'>" + RawScore + "</td></tr>"+
"<tr><td bgcolor='#336699'><strong>Maximum score:</strong></td>"+
"<td align='left' bgcolor='#6699cc'>" + MaxScore      + "</td></tr>" +
"<tr><td bgcolor='#336699'><strong>Accuracy:</strong></td>" +
"<td align='left' bgcolor='#6699cc'>" + Accuracy + "%</td></tr>" +
"<tr><td bgcolor='#336699'><strong>Your Name:</strong></td><td align='left' bgcolor='#6699cc'><input type='text' Name='name'></td></tr>" + "<tr><td bgcolor='#336699'><strong>Email Address:</strong></td><td align='left' bgcolor='#6699cc'><input type='text' Name='email'></td></tr>" + "<tr><td bgcolor='#336699'>" +
"<input type='hidden' value='robodemo' name='Test'>" +
"<input type='hidden' value='" + MaxScore + "' name='total'>" +
"<input type='hidden' value='" + RawScore + "' name='correct'>" +
"<input type='hidden' value='" + Accuracy + "' name='accuracy'>" +
"</td><td align='left' bgcolor='#6699cc'><input type='submit' name='Submit' value='Submit Your Score'></td></tr></table>" +
"</form></body></html>"

// function for the popup window
      function launchwin(htmlString){
         newwin = window.open("","flashcamwin","height=700,width=700,scrollbars=0");
         newwin.document.open();
         newwin.document.write(htmlString);
         newwin.document.close();
}

// launch the window
    launchwin(htmlString);

}


function padMail(strAddress, strSubject, strBody)
{
      gstrEmailTo = strAddress;
      gstrEmailSubject = strSubject;
      var temp_str = strBody;
      while(temp_str.indexOf("|") > -1)
      {
            temp_str = temp_str.substr(0,temp_str.indexOf("|")) + "\r" + temp_str.substr(temp_str.indexOf("|") + 1)
      }
      gstrEmailBody = temp_str + "\r";
}
// End -->
</script>

<form name="emailForm" action = "" method="POST" enctype="text/plain">
<input name="Results" type="hidden">
</form>
</head>

<body>
<center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="650" height="487" ID="Captivate1">
  <param name="movie" value="talkingtoparentsquiz.swf">
  <param name="quality" value="high">
  <param name="menu" value="false">
  <param name="loop" value="0">
  <embed src="talkingtoparentsquiz.swf" width="650" height="487" loop="0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed>
</object>
</center>
</body>
</html>

////////////////////////////////////////////////////////
The code for the inserting the results in the database is :

<cfquery datasource="myQuiz" name="insertData">
  INSERT INTO robodemo (total, correct, accuracy, name, email)
  VALUES (
  <cfif IsDefined("FORM.total") AND #FORM.total# NEQ "">
    '#FORM.Total#'
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.correct") AND #FORM.correct# NEQ "">
    #FORM.correct#
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.accuracy") AND #FORM.accuracy# NEQ "">
    '#FORM.accuracy#'
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.name") AND #FORM.name# NEQ "">
    '#FORM.name#'
      <cfelse>
      NULL
  </cfif>

THE ERROR THAT I'M GETTING IS THIS.

Error Executing Database Query.  
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.  

Can you help me with this ?
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
One cause of that error is forgetting to put single quotes around a string value (ie "this is a string").  

For example, if the data type of the "correct" column were "text",  you must put single quotes around the form field.  

 <cfif IsDefined("FORM.correct") AND #FORM.correct# NEQ "">
    <!--- notice the single quotes here --->
    '#FORM.correct#'
  <cfelse>
      NULL
  </cfif>

Commented:
In the section you have specified for "inserting the results in the database", you are missing the "EMAIL" value.  You have five (5) fields listed in the INSERT statement:

INSERT INTO robodemo (total, correct, accuracy, name, email)

, yet you only have four (4) values available fore the insert.

Add the <CFIF...> for the EMAIL field and you should be good to go.

As a side note, there are ways you can simplify and more securely write your code by using tags such as the <CFPARAM...> with/without a scope (FORM, URL, etc), and/or <CFQUERYPARAM...> (highly recommended to prevent SQL injections).  Post a reply if you would like more info.

HTH, Rob
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
> In the section you have specified for "inserting the results in the database", you are missing
> the "EMAIL" value.  You have five (5) fields listed in the INSERT statement:

    That's true, but it looks the code is from the error message, which may or may not include
    the full query.   Access would return a different error message if the number of columns
    in the INSERT list was different than the number of values in the VALUES statement.

> <CFQUERYPARAM...> (highly recommended to prevent SQL injections).
 
   I suspect the code was automatically generated by an IDE.  But yes, <cfqueryparam>
   is recommended.  It also has other benefits.  For example, you don't have to worry about
   single quoting string values.  <cfqueryparam> handles it automatically. It also supports the
   "null" attribute. So instead of writing this

 <cfif IsDefined("FORM.total") AND #FORM.total# NEQ "">
    '#FORM.Total#'
      <cfelse>
      NULL
  </cfif>
           
You could use <cfparam> to define a default for all your form variables

     <!--- ensure that form.total always exists --->
    <cfparam name="form.total" default="" />
    <cfparam name="form.correct" default="" />
    ... etc ...

Then use <cfqueryparam> in your INSERT statement

    INSERT INTO robodemo (total, correct, accuracy, name, email)
    VALUES
    (
     <!--- if form.total is empty, NULL will be inserted --->
    <cfqueryparam value="#form.total#" cfsqltype="cf_sql_varchar" null="#not len(trim(form.total))#" />,
    ... other fields ...
    )


Author

Commented:
After correcting the quotes for string values only I still get the  error
Error Executing Database Query.  
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.  

Do I have to have the variables defined in the quiz page?

<cfquery datasource="myQuiz" name="insertData">
  INSERT INTO robodemo (total, correct, accuracy, name, email)
  VALUES (
  <cfif IsDefined("FORM.total") AND #FORM.Total# NEQ "">
    #FORM.total#
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.correct") AND #FORM.correct# NEQ "">
    #FORM.correct#
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.accuracy") AND #FORM.Accuracy# NEQ "">
    #FORM.accuracy#
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.name") AND #FORM.Name# NEQ "">
    '#FORM.name#'
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.email") AND #FORM.Email# NEQ "">
    '#FORM.email#'
      <cfelse>
      NULL
  </cfif>
  )
  </cfquery>
  <html>
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
> Do I have to have the variables defined in the quiz page

1.  Not necessarily.  The form field variables  FORM.total, FORM.email, etc... should be created automatically when you submit the form.  Can you post your quiz page form code?

2. Open your Access database.  What are the data types of each of these columns:
  total
  correct,
  accuracy,
  name,
  email

(text, number, ...?)

Author

Commented:
Here's the code I have for the quiz page.

<!-- saved from url=(0013)about:internet -->
<!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=utf-8">
<title>talkingtoparentsquiz</title>
<script type="text/javascript">
<!-- Begin
var gstrEmailTo = "";
var gstrEmailSubject = "";
var gstrEmailBody = "";
var myVar = 0;

function appendEmailBody(strBody)
{
      var temp_str = strBody;
      while(temp_str.indexOf("|") > -1)
      {
            temp_str = temp_str.substr(0,temp_str.indexOf("|")) + "\r" + temp_str.substr(temp_str.indexOf("|") + 1)
      }
      gstrEmailBody += temp_str + "\r";
}

function sendMail()
{

      // strip the word Core Data out of the results
      var stripCoreData = gstrEmailBody.replace("Core Data", "");
      // remove the double quotes
      var stripQuotes = stripCoreData;
      while(stripQuotes.indexOf("\"") !=-1){
      stripQuotes=stripQuotes.replace("\"", "");
      }
      // turn results into an array to access single items
      var results_array = stripQuotes.split(",");

      // assign variables
      var RawScore = results_array[7];
      var MaxScore = results_array[8];
      var MinScore = results_array[9];
      var Accuracy = RawScore/MaxScore;
      Accuracy = Accuracy*100;

// write html for popup window
var htmlString=
"<html><head><title>Email Results</title></head><body>" +
"<form Name='results' method='post' action='insert.cfm'>" +
"<table cellspacing=1 cellpadding=4 border=0><tr><td bgcolor='#336699'><strong>Your score:</strong></td>" +
"<td align='left' bgcolor='#6699cc'>" + RawScore + "</td></tr>"+
"<tr><td bgcolor='#336699'><strong>Maximum score:</strong></td>"+
"<td align='left' bgcolor='#6699cc'>" + MaxScore      + "</td></tr>" +
"<tr><td bgcolor='#336699'><strong>Accuracy:</strong></td>" +
"<td align='left' bgcolor='#6699cc'>" + Accuracy + "%</td></tr>" +
"<tr><td bgcolor='#336699'><strong>Your Name:</strong></td><td align='left' bgcolor='#6699cc'><input type='text' Name='name'></td></tr>" + "<tr><td bgcolor='#336699'><strong>Email Address:</strong></td><td align='left' bgcolor='#6699cc'><input type='text' Name='email'></td></tr>" + "<tr><td bgcolor='#336699'>" +
"<input type='hidden' value='robodemo' name='Test'>" +
"<input type='hidden' value='" + MaxScore + "' name='total'>" +
"<input type='hidden' value='" + RawScore + "' name='correct'>" +
"<input type='hidden' value='" + Accuracy + "' name='accuracy'>" +
"</td><td align='left' bgcolor='#6699cc'><input type='submit' name='Submit' value='Submit Your Score'></td></tr></table>" +
"</form></body></html>"
// function for the popup window
      function launchwin(htmlString){
         newwin = window.open("","flashcamwin","height=700,width=700,scrollbars=0");
         newwin.document.open();
         newwin.document.write(htmlString);
         newwin.document.close();
}

// launch the window
    launchwin(htmlString);

}


function padMail(strAddress, strSubject, strBody)
{
      gstrEmailTo = strAddress;
      gstrEmailSubject = strSubject;
      var temp_str = strBody;
      while(temp_str.indexOf("|") > -1)
      {
            temp_str = temp_str.substr(0,temp_str.indexOf("|")) + "\r" + temp_str.substr(temp_str.indexOf("|") + 1)
      }
      gstrEmailBody = temp_str + "\r";
}
// End -->
</script>

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<form name="emailForm" action = "" method="POST" enctype="text/plain">
<input name="Results" type="hidden">
</form>
</head>

<body>
<center>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0','width','650','height','487','id','Captivate1','src','talkingtoparentsquiz','loop','0','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','menu','false','movie','talkingtoparentsquiz' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="650" height="487" ID="Captivate1">
  <param name="movie" value="talkingtoparentsquiz.swf">
  <param name="quality" value="high">
  <param name="menu" value="false">
  <param name="loop" value="0">
  <embed src="talkingtoparentsquiz.swf" width="650" height="487" loop="0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed>
</object></noscript>
</center>
</body>
</html>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The data types for the table are : test (text), total (number), correct (number), attempts (number), steps (number), accuracy (number), name (text) and email (text).
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
> The data types for the table are :

The quoting seems correct for those data types. Though you should consider using <cqueryparam>

If full debugging is enabled, the error message should include the sql statement that was sent to the database.  Could you post that sql here?

Author

Commented:
This is the debugging error I get in the exceptions box.

09:59:25.025 - Database Exception - in C:\CFusionMX7\wwwroot\oxfordemployee\insert.cfm : line 32
          Error Executing Database Query.
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
If you can't find the statement, add this to the insert page _before_ the query. It will reconstruct the sql statement


The sql query sent to the database is:<br>
<cfoutput>
  INSERT INTO robodemo (total, correct, accuracy, name, email)
  VALUES (
  <cfif IsDefined("FORM.total") AND #FORM.Total# NEQ "">
    '#FORM.total#'
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.correct") AND #FORM.correct# NEQ "">
    #FORM.correct#
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.accuracy") AND #FORM.Accuracy# NEQ "">
    #FORM.accuracy#
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.name") AND #FORM.Name# NEQ "">
    '#FORM.name#'
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.email") AND #FORM.Email# NEQ "">
    '#FORM.email#'
      <cfelse>
      NULL
  </cfif>
  )
<cfoutput>
<hr>

Author

Commented:
Here's the SQL query.  It's still gives me an error for the query at line 32 which is the closing </cfif> tag.
/////////////////////////////////////////////////////////////////////////////////////////////
SQL Queries

insertData (Datasource=myQuiz, Time=0ms, Records=0) in C:\CFusionMX7\wwwroot\oxfordemployee\insert.cfm @ 12:04:12.012

  INSERT INTO robodemo(total, correct, accuracy, name, email)
  VALUES (
 
      NULL
 
  ,
 
      NULL
 
  ,
 
      NULL
 
  ,
 
      NULL
 
  ,
 
      NULL
 
  )

CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
There's a typo. The last few lines should be
    ...
     )
    </cfoutput>
    <hr>

instead of
    ...
     )
   <cfoutput>
    <hr>

But it looks like you ran the insert page by itself.  Can you use your form, so I can see the values that generate the query error:

[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.  

Author

Commented:
The javascript in my quiz page pulls up a window that allows the user to add in their name and email address.  I do get an undefined text for the "Your Score" and "Maximum Score" fields.  Once they enter their information then I would get the error:

Error Executing Database Query.  
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.  

Database Exception - in C:\CFusionMX7\wwwroot\oxfordemployee\insert.cfm : line 32
          Error Executing Database Query
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
>  I do get an undefined text for the "Your Score" and "Maximum Score" fields.  

Did you follow the same steps you used when you got the error the first time? I can't see your quiz, and I'm not familiar with Captivate so I can't really offer you any advice there.

> Once they enter their information then I would get the error:

Okay, but if you add the code I posted to the insert page _before_ the cfquery code, you should be able to see the sql statement _before_ that error message appears.

Author

Commented:
I added and ran the <cfoutput> code from the insert file and it gives me  the following SQL below.  When I complete the quiz and fill out the form it has a problem opening the insert page.

SQL Queries

insertData (Datasource=myQuiz, Time=0ms, Records=0) in C:\CFusionMX7\wwwroot\oxfordemployee\insert.cfm @ 14:26:13.013

  INSERT INTO robodemo(total, correct, accuracy, name, email)
  VALUES (
 
      NULL
 
  ,
 
      NULL
 
  ,
 
      NULL
 
  ,
 
      NULL
 
  ,
 
      NULL
 
  )

CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
> When I complete the quiz and fill out the form it has a problem opening the insert page.

   What kind of error, javascript, ColdFusion..?


Let's try a different approach: testing your cfquery with some sample values.   Place this code in your "insert.cfm" file and run it.  I tested it against an access db, using the column types you provided, so it should work fine.

INSERT.CFM PAGE:

   <!--- these are sample values. use for testing/debugging purposes only --->
   <!---start:  remove these values when you've when finished testing: --->
   <cfset form.total = 10>
   <cfset form.correct = 8>
   <cfset form.accuracy = 80>
   <cfset form.name = "test one">
   <cfset form.email = "testemail@somecompany.com">
   <!---end:  remove these values when you've when finished testing: --->
   

   <cfquery datasource="myQuiz" name="insertData">
     INSERT INTO robodemo (total, correct, accuracy, name, email)
     VALUES
     (
        <cfqueryparam value="#form.total#" cfsqltype="cf_sql_integer" null="#not isNumeric(form.total)#">
        ,
        <cfqueryparam value="#form.correct#" cfsqltype="cf_sql_integer" null="#not isNumeric(form.correct)#">
        ,
        <cfqueryparam value="#form.accuracy#" cfsqltype="cf_sql_integer" null="#not isNumeric(form.accuracy)#">
        ,
        <cfqueryparam value="#form.Name#" cfsqltype="cf_sql_varchar" null="#not len(trim(form.name))#">
        ,
        <cfqueryparam value="#form.email#" cfsqltype="cf_sql_varchar" null="#not len(trim(form.email))#">
     )
   </cfquery>

Author

Commented:
Yes! Your approach works. I tested the cfset values and they are posted in the database.  After testing I removed the temp variables and ran the quiz.  The quiz would post the name and email but would not send any values.  I not sure why.  Do I need to correct the javascript in the quiz?
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
Yes, it does seem like the query error is fixed and this is a different problem with the javascript form code.  Keep in mind I'm not familiar with Captivate, so I'm just guessing.

You could put a cfdump statement at the top of the insert.cfm page (before the query).  
     <cfdump var="#FORM#">

When you submit the quiz form, CF will show all of the form fields that were posted.  Check the field names. If you only see "name" and "email" (not the other fields) then its suggests a problem with the javascript used to generate your form.

Author

Commented:
I used <cfdump> and it gives me a result of :
ACCURACY NaN  
CORRECT undefined  
EMAIL      anthony2  
FIELDNAMES       NAME,EMAIL,TEST,TOTAL,CORRECT,ACCURACY,SUBMIT  
NAME    asdfasdf  
SUBMIT    Submit Your Score  
TEST   robodemo  
TOTAL   undefined  
Some how the javascript in my orignial quiz is not defining the number correct, total,  and accuracy.
The current code for the quiz is :

var gstrEmailTo = "";
var gstrEmailSubject = "";
var gstrEmailBody = "";
var myVar = 0;

function appendEmailBody(strBody)
{
      var temp_str = strBody;
      while(temp_str.indexOf("|") > -1)
      {
            temp_str = temp_str.substr(0,temp_str.indexOf("|")) + "\r" + temp_str.substr(temp_str.indexOf("|") + 1)
      }
      gstrEmailBody += temp_str + "\r";
}

function sendMail()
{

      // strip the word Core Data out of the results
      var stripCoreData = gstrEmailBody.replace("Core Data", "");
      // remove the double quotes
      var stripQuotes = stripCoreData;
      while(stripQuotes.indexOf("\"") !=-1){
      stripQuotes=stripQuotes.replace("\"", "");
      }
      // turn results into an array to access single items
      var results_array = stripQuotes.split(",");

      // assign variables
      var RawScore = results_array[7];
      var MaxScore = results_array[8];
      var MinScore = results_array[9];
      var Accuracy = RawScore/MaxScore;
      Accuracy = Accuracy*100;

// write html for popup window
var htmlString=
"<html><head><title>Email Results</title></head><body>" +
"<form Name='results' method='post' action='insert.cfm'>" +
"<table cellspacing=1 cellpadding=4 border=0><tr><td bgcolor='#336699'><strong>Your score:</strong></td>" +
"<td align='left' bgcolor='#6699cc'>" + RawScore + "</td></tr>"+
"<tr><td bgcolor='#336699'><strong>Maximum score:</strong></td>"+
"<td align='left' bgcolor='#6699cc'>" + MaxScore      + "</td></tr>" +
"<tr><td bgcolor='#336699'><strong>Accuracy:</strong></td>" +
"<td align='left' bgcolor='#6699cc'>" + Accuracy + "%</td></tr>" +
"<tr><td bgcolor='#336699'><strong>Your Name:</strong></td><td align='left' bgcolor='#6699cc'><input type='text' Name='name'></td></tr>" + "<tr><td bgcolor='#336699'><strong>Email Address:</strong></td><td align='left' bgcolor='#6699cc'><input type='text' Name='email'></td></tr>" + "<tr><td bgcolor='#336699'>" +
"<input type='hidden' value='robodemo' name='Test'>" +
"<input type='hidden' value='" + MaxScore + "' name='total'>" +
"<input type='hidden' value='" + RawScore + "' name='correct'>" +
"<input type='hidden' value='" + Accuracy + "' name='accuracy'>" +
"</td><td align='left' bgcolor='#6699cc'><input type='submit' name='Submit' value='Submit Your Score'></td></tr></table>" +
"</form></body></html>"

// function for the popup window
      function launchwin(htmlString){
         newwin = window.open("","flashcamwin","height=300,width=325,scrollbars=0");
         newwin.document.open();
         newwin.document.write(htmlString);
         newwin.document.close();
}

// launch the window
    launchwin(htmlString);

}

function padMail(strAddress, strSubject, strBody)
{
      gstrEmailTo = strAddress;
      gstrEmailSubject = strSubject;
      var temp_str = strBody;
      while(temp_str.indexOf("|") > -1)
      {
            temp_str = temp_str.substr(0,temp_str.indexOf("|")) + "\r" + temp_str.substr(temp_str.indexOf("|") + 1)
      }
      gstrEmailBody = temp_str + "\r";
}
// End -->
</script>

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<form name="emailForm" action = "" method="POST" enctype="text/plain">
<input name="Results" type="hidden">
</form>
</head>

<body>
<center>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0','width','650','height','487','id','Captivate1','src','talkingtoparentsquiz','loop','0','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','menu','false','movie','talkingtoparentsquiz' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="650" height="487" ID="Captivate1">
  <param name="movie" value="talkingtoparentsquiz.swf">
  <param name="quality" value="high">
  <param name="menu" value="false">
  <param name="loop" value="0">
  <embed src="talkingtoparentsquiz.swf" width="650" height="487" loop="0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed>
</object></noscript>
</center>
</body>
</html>

Do I need to adjust the variables for htmlString?
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.