Создание тестовой системы и счетчика посещений страницы средствами CGI и PHP (CGI-модуль и PHP-скрипт психологического теста), страница 4

       cout << "submit_form.iskren_hidden.value = iskren" << endl;

       cout << "submit_form.extrav_hidden.value = extrav" << endl;

       cout << "submit_form.rigid_hidden.value = rigid" << endl;

       cout << "submit_form.emo_vozb_hidden.value = emo_vozb" << endl;

       cout << "submit_form.temp_reak_hidden.value = temp_reak" << endl;

       cout << "submit_form.aktiv_hidden.value = activ" << endl;

       cout << "}" << endl;

       //Взятие результатов

       cout << "function get_param(object)" << endl;

       cout << "{" << endl;

       cout << "if(object.elements[0].checked)" << endl;

       cout << "{" << endl;

       cout << "param = 1" << endl;

       cout << "return param" << endl;

       cout << "}" << endl;

       cout << "if(object.elements[1].checked)" << endl;

       cout << "{" << endl;

       cout << "param = 0" << endl;

       cout << "return param" << endl;

       cout << "}" << endl;

       cout << "}" << endl;

       cout << "function checking(object)" << endl;

       cout << "{" << endl;

       cout << "i++" << endl;

       cout << "get_param(object)" << endl;

       cout << "check_iskren(param,i)" << endl;

       cout << "check_extrav(param,i)" << endl;

       cout << "check_rigid(param,i)" << endl;

       cout << "check_emo_vozb(param,i)" << endl;

       cout << "check_temp_reak(param,i)" << endl;

       cout << "check_activ(param,i)" << endl;

       cout << "update_submit_form()" << endl;

       cout << "param = 2" << endl;

       cout << "}" << endl;

       cout << "</script>" << endl;

}

void main()

{

       int i;

       cout << "Content-type: text/html \n\n";

       cout << "<html>" << endl;

       cout << "<head>" << endl;

       cout << "<title>Самооценка структуры темперамента</title>" << endl;

       print_script();

       cout << "</head>" << endl;

       cout << "<body>" << endl;

       cout <<"<iframe name = visit src = 'http://localhost/cgi/test_visit.exe' height = 35 width = 50% border = no></iframe><br>" << endl;

       for(i = 1; i < 49; i++)

       {

              cout << i << ")" << ' ' << voprosy[i] << endl;

              cout << "<form name = answer_form_"<< i <<">" << endl;

              print_answer_form(i);

       }

       print_submit_form();

       cout << "</body>" << endl;

       cout << "</html>" << endl;

}

PHP-скрипт

#!/usr/bin/php

<?

echo "<html>\n<head>\n<title>Самооценка структуры темперамента</title>\n";

echo "<script language = 'javascript'>\n\n";

echo "var iskren = 0\n";                   //Искренность

echo "var extrav = 0\n";                   //Экстраверсия

echo   "var rigid = 0\n";                  //Ригидность

echo   "var emo_vozb = 0\n";               //Эмоциональная возбудимость

echo "var temp_reak = 0\n";         //Темп реакций

echo   "var activ = 0\n";                  //Активность