Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail function

Status
Not open for further replies.

Soti

Programmer
Jul 9, 2001
34
US
Can anyone figure out why this code isn't working? I'm not getting any parse error messages but it's not going into my inbox.
Thanks!

<?php
if (!(isset($qa))){
$qa=&quot;&quot;;

} else {

$subject = &quot;Quiz&quot;;
$m = sprintf (&quot;Quiz\n----------------------\n\n%s %s %s\nIn 1997, ____ of households were headed by women %s\nIn 1999, women hold ____ of the seats in the 535 member 106th Congress %s\nIn 1992 and 1994, ____ of women registered to vote actually voted in the national elections. %s\nIn 1997, ____ of all women between the ages of 25 and 54 were in the labor force %s\nIn 1997, women represented approximately ____ of lawyers and doctors and approximately ____ of engineers and Fortune 500 corporate officers %s\nIn 1997, among year-round fulltime workers, women’s weekly earnings were ____ of men’s %s\nIn 1997, women and children (under 18) represented ____ of the total number of people living in poverty %s\nIn 1995, about one in every ____ American girls between the ages of 15 and 19 became pregnant %s\nApproximately ____ of high school girls participate in at least one school-sponsored sport %s\nIn 1960, 38 percent of girls who graduated from high school enrolled in college the following fall. In 1996 ____ of girls who graduated from high school enrolled in college the following fall&quot;, stripslashes($qa1), stripslashes($qa2), stripslashes($qa3), stripslashes($qa4), stripslashes($qa5), stripslashes($qa6), stripslashes($qa7), stripslashes($qa8), stripslashes($qa9), stripslashes($qa10));

mail(&quot;mlluberes@hotmail&quot;, $subject, $m, &quot;$qa1 \n $qa2 \n $qa3 \n $qa4 \n $qa5 \n $qa6 \n $qa7 \n $qa8 \n $qa9 \n $qa10&quot;);
}
?>

 
A couple of things:

1. check your conditional ($qa) and check to see if it is actually being passed and the value is not null.

2. The parameter count for sprintf does not match the number of string placements you have. You show 12 %s whereas you only pass 10 $qa... vars. This will most definitely (at the least) provide a warning.

3. The mail() function is supposed to be passed as mail(&quot;email address&quot;,&quot;subject&quot;,&quot;body&quot;,&quot;additional headers&quot;);

Additional headers consists of mail headers you want passed for additional instructions to the mail server/client. You should not pass any other data here. This may also be causing you some problems.

4. Make sure you have the mail configured correctly in your php.ini file.

Chad. ICQ: 54380631
 
I tried all of the suggestions--still not working-here's the updated code, any other suggestions?

<?php
if (!(isset($qa))){
$qa=&quot;&quot;;

} else {

$subject = &quot;Quiz&quot;;
$m = sprintf (&quot;Quiz\n----------------------\n\n %s\nIn 1997, ____ of households were headed by women %s\nIn 1999, women hold ____ of the seats in the 535 member 106th Congress %s\nIn 1992 and 1994, ____ of women registered to vote actually voted in the national elections. %s\nIn 1997, ____ of all women between the ages of 25 and 54 were in the labor force %s\nIn 1997, women represented approximately ____ of lawyers and doctors and approximately ____ of engineers and fortune 500 corporate officers %s\nIn 1997, among year-round fulltime workers, women’s weekly earnings were ____ of men’s %s\nIn 1997, women and children (under 18) represented ____ of the total number of people living in poverty %s\nIn 1995, about one in every ____ American girls between the ages of 15 and 19 became pregnant %s\nApproximately ____ of high school girls participate in at least one school-sponsored sport %s\nIn 1960, 38 percent of girls who graduated from high school enrolled in college the following fall. In 1996 ____ of girls who graduated from high school enrolled in college the following fall&quot;, stripslashes($qa1), stripslashes($qa2), stripslashes($qa3), stripslashes($qa4), stripslashes($qa5), stripslashes($qa6), stripslashes($qa7), stripslashes($qa8), stripslashes($qa9), stripslashes($qa10));

mail(&quot;mlluberes@girls-inc.org&quot;, $subject, $m);

}

?>
 
Question:

What are you using

if (!(isset($qa))){
$qa=&quot;&quot;;
} else {

for? What is the $qa used for? Are you expecting $qa to be set and still execute the sending of the email?

Here is what I did to test your snippet:

I created test values for the $qa1...$qa10 vars, then tested the script by not passing any parameters to the script (no ?qa=1), and then tested the script by passing the ?qa=something parameter.

The first test, of course, did not send mail. The second worked just find (you should have received an email at mlluberes@girls-inc.org as I was a secondary recipient and I got it just fine).

I don't know how else to help you other than the above $qa check and then there is obviously something else going on with either another section of your script or on the server itself.

Chad. ICQ: 54380631
 
I got that email as well, what I am doing is a multiple choice quiz programmed in javascript, I'm completely new to PHP, maybe it has to do with qa being an array? This is the entire code:

#!#TITLE
Take Action
#!#JS
#!#BODY
?>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
var qa = new Array('C 30%','B 13%','D 80%','E 74%','A 30% 10%','C 75%','E 80%','B 10','C 42%','D 70%');

var expl = new Array();
expl[0] = &quot;In 1997, <b>30%</b> of households were headed by women.&quot;
expl[1] = &quot;In 1999, women held <b>13%</b> of the seats in the 535- member 106th Congress. In 2001, women hold 73, or 13.6%, of the 535 seats in the 107th US Congress.&quot;
expl[2] = &quot;In 1992 and 1994, <b>80%</b> of women registered to vote actually voted in the national elections.&quot;
expl[3] = &quot;In 1997, <b>74%</b> of all women between the ages of 25 and 54 were in the labor force.&quot;
expl[4] = &quot;In 1997, women represented approximately <b>30%</b> of lawyers and doctors and approximately <b>10%</b> of engineers and fortune 500 corporate officers.&quot;
expl[5] = &quot;In 1997, among year-round full time workers, women’s weekly earnings were <b>75%</b> of men’s.&quot;
expl[6] = &quot;In 1997, women and children (under 18) represented <b>80%</b> of the total number of people living in poverty.&quot;
expl[7] = &quot;In 1995, about one in every <b>10</b> American girls between the ages of 15 and 19 became pregnant.&quot;
expl[8] = &quot;Approximately <b>42%</b> of high school girls participate in at least one school-sponsored sport.&quot;
expl[9] = &quot;In 1960, 38 percent of girls who graduated from high school enrolled in college the following fall. In 1996, <b>70%</b> of girls who graduated from high school enrolled in college the following fall.&quot;



function display(x)
{
var i,j,t;
var display = window.open('', 'NewWin');
display.document.write(&quot;<html>&quot;);
display.document.write(&quot;<font face = Arial>&quot;);
display.document.write(&quot;<body bgcolor=#ffffcc>&quot;);
display.document.write(&quot;<h2>Facts about Women and Girls Quiz</h2>&quot;);
display.document.write(&quot;Read below to see your results.<br><br>&quot;);
for (i=0;i<qa.length;i++)
{
answer = '?';
t = eval('x.qa'+(i+1));
for (j=0;j<5;j++) {
if (t[j].checked) {
answer = t[j].value;
break;
}
}

display.document.writeln('<b>',i+1,'</b>');
display.document.write(&quot;. <b><font color=003399> You answered: &quot; + answer + &quot;, the correct answer is: &quot; +qa+&quot;</font></b><br><b>Fact: </b>&quot;+expl + '<P>')
}
display.document.write(&quot;View our <a href=page.php?id=3.1.13a>Resources</a> for the facts about Women and Girls Quiz&quot;);
display.document.close();
}


// End -->
</SCRIPT>


<font size=2 face=Arial>
<h5>How much do you know about the status of women and girls? Test your
knowledge and take our facts about Women and Girls Quiz! Just take a
few minutes to complete the following 10 questions.</h5>

<noscript>JavaScript is <b><i>disabled</i></b>. We're sorry, you must have JavaScript enabled in order to take our quiz.</noscript>
<hr noshade>

<form name=&quot;qa&quot; action=&quot;page.php?id=3.1.13.txt&quot; method=&quot;POST&quot;>
<b>1. In 1997, ____ of households were headed by women?</b><p>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;A 18%&quot;>18%<br>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;B 25%&quot;>25%<br>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;C 30%&quot;>30%<br>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;D 46%&quot;>46%<br>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;E 51%&quot;>51%<br><p>

<b>2. In 1999, women hold ____ of the seats in the 535 member 106th Congress.</b><p>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;A 9%&quot;>9%<br>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;B 13%&quot;>13%<br>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;C 26%&quot;>26%<br>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;D 51%&quot;>51%<br>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;E 65%&quot;>65%<p>

<b>3. In 1992 and 1994, ____ of women registered to vote actually voted in the national elections. </b><p>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;A 29%&quot;>29%<br>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;B 41%&quot;>41%<br>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;C 62%&quot;>62%<br>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;D 80%&quot;>80%<br>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;E 95%&quot;>95%<p>

<b>4. In 1997, ____ of all women between the ages of 25 and 54 were in the labor force.</b><p>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;A 33%&quot;>33%<br>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;B 45%&quot;>45%<br>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;C 50%&quot;>50%<br>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;D 62%&quot;>62%<br>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;E 74%&quot;>74%<br><p>

<b>5. In 1997, women represented approximately ____ of lawyers and doctors and approximately ____ of engineers and fortune 500 corporate officers. </b><p>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;A 30%, 10%&quot;>30%,10%<br>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;B 45%, 15%&quot;>45%,15%<br>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;C 50%, 25%&quot;>50%,25%<br>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;D 62%, 38%&quot;>62%,38%<br>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;E 74%, 51%&quot;>74%,51%<br>
<p>

<b>6.In 1997, among year-round fulltime workers, women’s weekly earnings were ____ of men’s </b><p>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;A 55%&quot;>55%<br>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;B 65%&quot;>65%<br>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;C 75%&quot;>75%<br>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;D 85%&quot;>85%<br>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;E 95%&quot;>95%<p>

<b>7. In 1997, women and children (under 18) represented ____ of the total number of people living in poverty </b><p>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;A 33%&quot;>33%<br>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;B 51%&quot;>51%<br>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;C 63%&quot;>63%<br>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;D 75%&quot;>75%<br>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;E 80%&quot;>80%<p>

<b>8. In 1995, about one in every ____ American girls between the ages of 15 and 19 became pregnant. </b><p>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;A 5&quot;>5<br>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;B 10&quot;>10<br>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;C 15&quot;>15<br>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;D 35&quot;>35<br>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;E 60&quot;>60<p>

<b>9. Approximately ____ of high school girls participate in at least one school-sponsored sport. </b><p>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;A 15%&quot;>15%<br>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;B 27%&quot;>27%<br>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;C 42%&quot;>42%<br>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;D 68%&quot;>68%<br>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;E 82%&quot;>82%<p>

<b>10. In 1960, 38 percent of girls who graduated from high school enrolled in college the following fall. In 1996 ____ of girls who graduated from high school enrolled in college the following fall </b><p>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;A 32%&quot;>32%<br>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;B 49%&quot;>49%<br>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;C 56%&quot;>56%<br>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;D 70%&quot;>70%<br>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;E 84%&quot;>84%<p>
<CENTER>
<input type=button value=&quot;Results&quot; onClick=&quot;display(this.form);&quot;>
</CENTER>
</fORM>
</font>

<?php
if (!(isset($qa))){
$qa=&quot;&quot;;

} else {

$subject = &quot;Quiz&quot;;
$m = sprintf (&quot;Quiz\n----------------------\n\n %s\nIn 1997, ____ of households were headed by women %s\nIn 1999, women hold ____ of the seats in the 535 member 106th Congress %s\nIn 1992 and 1994, ____ of women registered to vote actually voted in the national elections. %s\nIn 1997, ____ of all women between the ages of 25 and 54 were in the labor force %s\nIn 1997, women represented approximately ____ of lawyers and doctors and approximately ____ of engineers and fortune 500 corporate officers %s\nIn 1997, among year-round fulltime workers, women’s weekly earnings were ____ of men’s %s\nIn 1997, women and children (under 18) represented ____ of the total number of people living in poverty %s\nIn 1995, about one in every ____ American girls between the ages of 15 and 19 became pregnant %s\nApproximately ____ of high school girls participate in at least one school-sponsored sport %s\nIn 1960, 38 percent of girls who graduated from high school enrolled in college the following fall. In 1996 ____ of girls who graduated from high school enrolled in college the following fall&quot;, stripslashes($qa1), stripslashes($qa2), stripslashes($qa3), stripslashes($qa4), stripslashes($qa5), stripslashes($qa6), stripslashes($qa7), stripslashes($qa8), stripslashes($qa9), stripslashes($qa10));

mail(&quot;mlluberes@girls-inc.org&quot;, $subject, $m);

}
?>


I appreciate your help.
 
First problem:

When the submit button is clicked, a new window is written to which means that you are in effect, dynamically creating a new page; the form is technically not being 'submitted' becuase you are having javascript handle everything on the client side instead of the data being sent to the server for parsing.

Second problem:

A form name (in your case 'qa') does not get passed to PHP since this is not an input value that can be passed anyway. form names are typically the same as ids thus are references only. You need to make a hidden tag to make this useable: <input type=&quot;hidden&quot; name=&quot;qa&quot; value=&quot;true&quot;>

Third problem:

You cannot pass a query in your action attribute within your form tag. This is not only illegal, but will not result in anything. You need to move your id to a hidden tag: <input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;3.1.13.txt&quot;>


Here is a simple example of you you can solve these problems:
Code:
<?php
if(!$qa) {
?>
<html>
<head>
<title>quiz</title>
</head>
<body>

<font size=2 face=Arial>
<h5>How much do you know about the status of women and girls?  Test your
knowledge and take our facts about Women and Girls Quiz!  Just take a
few minutes to complete the following 10 questions.</h5>

<noscript>JavaScript is <b><i>disabled</i></b>.  We're sorry, you must have JavaScript enabled in order to take our quiz.</noscript>
<hr noshade>

<form name=&quot;qa&quot; action=&quot;mailtest.php?id=3.1.13.txt&quot; method=&quot;get&quot;>
<input type=&quot;hidden&quot; name=&quot;qa&quot; value=&quot;true&quot;>
<input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;3.1.13.txt&quot;>

<b>1. In 1997, ____ of households were headed by women?</b><p>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;A 18%&quot;>18%<br>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;B 25%&quot;>25%<br>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;C 30%&quot;>30%<br>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;D 46%&quot;>46%<br>
<input type=&quot;radio&quot; name=&quot;qa1&quot; value=&quot;E 51%&quot;>51%<br><p>

<b>2. In 1999, women hold ____ of the seats in the 535 member 106th Congress.</b><p>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;A 9%&quot;>9%<br>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;B 13%&quot;>13%<br>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;C 26%&quot;>26%<br>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;D 51%&quot;>51%<br>
<input type=&quot;radio&quot; name=&quot;qa2&quot; value=&quot;E 65%&quot;>65%<p>

<b>3. In 1992 and 1994, ____ of women registered to vote actually voted in the national elections. </b><p>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;A 29%&quot;>29%<br>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;B 41%&quot;>41%<br>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;C 62%&quot;>62%<br>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;D 80%&quot;>80%<br>
<input type=&quot;radio&quot; name=&quot;qa3&quot; value=&quot;E 95%&quot;>95%<p>

<b>4. In 1997, ____ of all women between the ages of 25 and 54 were in the labor force.</b><p>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;A 33%&quot;>33%<br>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;B 45%&quot;>45%<br>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;C 50%&quot;>50%<br>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;D 62%&quot;>62%<br>
<input type=&quot;radio&quot; name=&quot;qa4&quot; value=&quot;E 74%&quot;>74%<br><p>

<b>5. In 1997, women represented approximately ____ of lawyers and doctors and approximately ____ of engineers and fortune 500 corporate officers.  </b><p>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;A 30%, 10%&quot;>30%,10%<br>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;B 45%, 15%&quot;>45%,15%<br>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;C 50%, 25%&quot;>50%,25%<br>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;D 62%, 38%&quot;>62%,38%<br>
<input type=&quot;radio&quot; name=&quot;qa5&quot; value=&quot;E 74%, 51%&quot;>74%,51%<br>
<p>

<b>6.In 1997, among year-round fulltime workers, women’s weekly earnings were ____ of men’s </b><p>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;A 55%&quot;>55%<br>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;B 65%&quot;>65%<br>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;C 75%&quot;>75%<br>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;D 85%&quot;>85%<br>
<input type=&quot;radio&quot; name=&quot;qa6&quot; value=&quot;E 95%&quot;>95%<p>

<b>7. In 1997, women and children (under 18) represented ____ of the total number of people living in poverty </b><p>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;A 33%&quot;>33%<br>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;B 51%&quot;>51%<br>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;C 63%&quot;>63%<br>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;D 75%&quot;>75%<br>
<input type=&quot;radio&quot; name=&quot;qa7&quot; value=&quot;E 80%&quot;>80%<p>

<b>8. In 1995, about one in every ____ American girls between the ages of 15 and 19 became pregnant. </b><p>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;A 5&quot;>5<br>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;B 10&quot;>10<br>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;C 15&quot;>15<br>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;D 35&quot;>35<br>
<input type=&quot;radio&quot; name=&quot;qa8&quot; value=&quot;E 60&quot;>60<p>

<b>9. Approximately ____ of high school girls participate in at least one school-sponsored sport.  </b><p>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;A 15%&quot;>15%<br>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;B 27%&quot;>27%<br>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;C 42%&quot;>42%<br>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;D 68%&quot;>68%<br>
<input type=&quot;radio&quot; name=&quot;qa9&quot; value=&quot;E 82%&quot;>82%<p>

<b>10. In 1960, 38 percent of girls who graduated from high school enrolled in college the following fall. In 1996 ____ of girls who graduated from high school enrolled in college the following fall </b><p>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;A 32%&quot;>32%<br>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;B 49%&quot;>49%<br>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;C 56%&quot;>56%<br>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;D 70%&quot;>70%<br>
<input type=&quot;radio&quot; name=&quot;qa10&quot; value=&quot;E 84%&quot;>84%<p>
<CENTER>
<input type=submit  value=&quot;Results&quot;>
</CENTER>
</fORM>
</font>
</body>
</html>
<?php 
}
else {

$expl[0] = &quot;In 1997, <b>30%</b> of households were headed by women.&quot;;
$expl[1] = &quot;In 1999, women held <b>13%</b> of the seats in the 535- member 106th Congress. In 2001, women hold 73, or 13.6%, of the 535 seats in the 107th US Congress.&quot;;
$expl[2] = &quot;In 1992 and 1994, <b>80%</b> of women registered to vote actually voted in the national elections.&quot;;
$expl[3] = &quot;In 1997, <b>74%</b> of all women between the ages of 25     and 54 were in the labor force.&quot;;
$expl[4] = &quot;In 1997, women represented approximately <b>30%</b> of lawyers and doctors and approximately <b>10%</b> of engineers and fortune 500 corporate officers.&quot;;
$expl[5] = &quot;In 1997, among year-round full time workers, women’s weekly earnings were <b>75%</b> of men’s.&quot;;
$expl[6] = &quot;In 1997, women and children (under 18) represented <b>80%</b> of the total number of people living in poverty.&quot;;
$expl[7] = &quot;In 1995, about one in every <b>10</b> American girls between the ages of 15 and 19 became pregnant.&quot;;
$expl[8] = &quot;Approximately <b>42%</b> of high school girls participate in at least one school-sponsored sport.&quot;;
$expl[9] = &quot;In 1960, 38 percent of girls who graduated from high school enrolled in college the following fall. In 1996, <b>70%</b> of girls who graduated from high school enrolled in college the following fall.&quot;;

$qar[0] = &quot;C 30%&quot;;
$qar[1] = &quot;B 13%&quot;;
$qar[2] = &quot;D 80%&quot;;
$qar[3] = &quot;E 74%&quot;;
$qar[4] = &quot;A 30% 10%&quot;;
$qar[5] = &quot;C 75%&quot;;
$qar[6] = &quot;E 80%&quot;;
$qar[7] = &quot;B 10&quot;;
$qar[8] = &quot;C 42%&quot;;
$qar[9] = &quot;D 70%&quot;;

$ca[0] = $qa1;
$ca[1] = $qa2;
$ca[2] = $qa3;
$ca[3] = $qa4;
$ca[4] = $qa5;
$ca[5] = $qa6;
$ca[6] = $qa7;
$ca[7] = $qa8;
$ca[8] = $qa9;
$ca[9] = $qa10;

?>

<html>
<head><title>Answers</title>
</head>
<body bgcolor=&quot;#ffffcc&quot;>
<font face=&quot;arial&quot;>
<h2>Facts about Women and Girls Quiz</h2>
Read below to see your results.<br><br>

<?php
for($a=0;$a<count($expl);$a++) {
     $num = $a+1;
     echo &quot;<b>&quot;.$num.&quot;</b>\n&quot;;
     echo &quot;<b><font color=003399> You answered: &quot;.$ca[$a].&quot;, the correct answer is: &quot;.$qar[$a].&quot;</font></b><br><b>Fact: </b>&quot;.$expl[$a].&quot;<P>&quot;;
}
?>

View our <a href=page.php?id=3.1.13a>Resources</a> for the facts about Women and Girls Quiz
</font>

<?php
$subject = &quot;Quiz&quot;;
$m = sprintf (&quot;Quiz\n----------------------\n\n  %s\nIn 1997, ____ of households were headed by women %s\nIn 1999, women hold ____ of the seats in the 535 member 106th Congress %s\nIn 1992 and 1994, ____ of women registered to vote actually voted in the national elections. %s\nIn 1997, ____ of all women between the ages of 25 and 54 were in the labor force %s\nIn 1997, women represented approximately ____ of lawyers and doctors and approximately ____ of engineers and fortune 500 corporate officers %s\nIn 1997, among year-round fulltime workers, women’s weekly earnings were ____ of men’s %s\nIn 1997, women and children (under 18) represented ____ of the total number of people living in poverty %s\nIn 1995, about one in every ____ American girls between the ages of 15 and 19 became pregnant %s\nApproximately ____ of high school girls participate in at least one school-sponsored sport %s\nIn 1960, 38 percent of girls who graduated from high school enrolled in college the following fall. In 1996 ____ of girls who graduated from high school enrolled in college the following fall&quot;, stripslashes($qa1), stripslashes($qa2), stripslashes($qa3), stripslashes($qa4), stripslashes($qa5), stripslashes($qa6), stripslashes($qa7), stripslashes($qa8), stripslashes($qa9), stripslashes($qa10));
mail(&quot;chorton@inlandpac.com&quot;, $subject, $m, &quot;From:chorton@inlandpac.com\n&quot;);

?>
</body>
</html>
<?php
}
?>
 
After making the changes that you describe above I am getting the following error message:

Parse error: parse error in f:\feast/ic/page.php(257) : eval()'d code on line 1

I believe that the reason that I'm getting that message is because of our server settings, it is configured to give me a warning if I use a variable before defining it (although this is legal in php). I have resolved this issue in the past by plugging in the following code:
<?php

if (!(isset($qa))){
$qa=&quot;&quot;;

} else {

although this is not working now.

As far as my second problem, I did have the following line in the code, perhaps I deleted it briefly before I copied it to the forum:

<form name=&quot;f&quot; action=&quot;<?php echo $PHP_SELF.&quot;?id=3.1.13&quot;; ?>&quot; method=&quot;POST&quot;>
<input type=&quot;hidden&quot; name=&quot;s&quot; value=&quot;1&quot;>

would this serve the same purpose as the code that you provided above?


I'm really stuck here!! I've been working on this for quite awhile and its just beginning to look like a huge blur to me! I appreciate your help.
 
You cannot pass a parameter in the action=&quot;&quot; attribute for your form tag!

<form name=&quot;f&quot; action=&quot;<?php echo $PHP_SELF; ?>&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;3.1.13&quot;>
<input type=&quot;hidden&quot; name=&quot;s&quot; value=&quot;1&quot;>
and so on....


You can use the same sample I provided above, but just define your vars before they are used:

<?php if(!isset($qa)) {
$qa = &quot;&quot;;

.......and other stuff I put here (html, etc).

}
else {
$expl = array();
$qar = array();
$ca = array();

.......and other stuff I put here (html, etc).
}
?>

Chad. ICQ: 54380631
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top