At 8:53 AM -0400 10/9/05, Matthew Gregg wrote:
>I'll have to look around the code to see if this would be possible
>or addable. I know a sec=# is POST'ed from the survey on multiple
>page surveys. It might be enough to accept that from a GET instead.
>I'll get back to you.
First off, thanks for all the help and suggestions, some proved quite
useful. My original goal was to get phpESP working with custom html
files, so that questions could be regrouped, and organized in a
format different than that provided by the auto-generated system.
Originally I thought redirects and cookies/sessions would work, but
life was more complicated than that.
So in the quest to get this system working, it was determined that
the best way to proceed would be to adjust the /public/handler.php
file. Since ONLY this survey would be active during the time period,
I figured we could easily restore the handler to its former state.
So I worked with another programmer, and they adjusted the
handler.php file after the end of the JavaScript which includes
function other_check(name). The following text was included:
<?php
function get_values($startnum,$endnum) {
//fetch sql entries from $startnum to $endnum
//return array of values
//$values = array();
/*
$index=1;
for($i=$startnum; $i<=$endnum; i++) {
//fetch sql entry at $i
$thisvalue="?";
$values[$index]=$thisvalue;
}
*/
return 0;
}
function replace_values($formhtml, $values) {
//match <input ... > strings in $formhtml
//replace old value attributes with value stored in $values array
/*
$formhtml = preg_replace($pattern, "<input value=$values[1] $1", $formhtml);
for($i=1; $i<=count($values); i++) {
//match
}
*/
return $formhtml;
}
$sec=$HTTP_POST_VARS['sec'];
if ($sid==3) {
if ($msg!="")
echo "<font color=\"#ff0000\">$msg</font><br><br>";
if ($sec=="1") {
$formhtml =
file_get_contents('http://nahic.ucsf.edu/phpESP/public/form1.html');
echo replace_values($formhtml, get_values(1,41));
}
else if ($sec=="2") {
$formhtml =
file_get_contents('http://nahic.ucsf.edu/phpESP/public/form2.html');
echo replace_values($formhtml, get_values(42,55));
}
else if ($sec=="3") {
$formhtml =
file_get_contents('http://nahic.ucsf.edu/phpESP/public/form3.html');
echo replace_values($formhtml, get_values(56,102));
}
else if ($sec=="4") {
$formhtml =
file_get_contents('http://nahic.ucsf.edu/phpESP/public/form4.html');
echo replace_values($formhtml, get_values(103,121));
}
else if ($sec=="5") {
$formhtml =
file_get_contents('http://nahic.ucsf.edu/phpESP/public/form5.html');
echo replace_values($formhtml, get_values(122,140));
}
}
else {
survey_render($sid,$sec,$msg);
}
?>
Basically just a quick script that allows the forms to be encased in
the system. This partially works. If you go to
http://nahic.ucsf.edu/phpESP/survey.php and log in you'll see that
the buttons basically work, the problem is:
If the user selects save/submit option, when they resume they are not
taken back to the page that they stopped on; which would be fine, if
I could get the forms to echo back priorly submitted data. But it
seems as if prior data rendering is handled by the
/admin/function/survey_render.inc file which we're not using.
Does anyone have any ideas on if its possible to use the phpESP
database queries to retrieve data, without rendering it (displaying
the html)? Basically, what I'd like to do is revise the included
forms so they contain <?=$field?> statements to echo back the current
data. I'm also willing to have the echo form be unformatted, so long
as the next paged called is formatted.
Any ideas??
Alnisa |