PHP Survey-displaying results on final page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jagweb
Forum Newbie
Posts: 2
Joined: Mon Oct 31, 2005 9:09 pm

PHP Survey-displaying results on final page

Post by jagweb »

Hi,

I am using the phpsurveyor script and am trying to display the results of the survey before the person submits it. The page would allow the person to review their entries.


I know it can be done because it is displayed in the confirmation email sent to the administrator when someone submits a survey.

Here is the code that displays the results of the survey in the email

Code: Select all

if ($sendnotification > 1)
		{ //Send results as well. Currently just bare-bones - will be extended in later release
		$message .= "----------------------------\r\n";
		foreach ($_SESSION['insertarray'] as $value)
			{
			$questiontitle=returnquestiontitlefromfieldcode($value);
			$message .= "$questiontitle:   ";
			if (isset($_SESSION[$value]))
				{
			    $message .= getextendedanswer($value, $_SESSION[$value]);
				}
			$message .= "\r\n";
			}
		$message .= "----------------------------\r\n\r\n";
		}


If you need to see the rest of the code I can add it

How do I add the results of the survey into a regular .php page?


Thanks I am an html person and am do not use php often.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

copy out the foreach loop...
jagweb
Forum Newbie
Posts: 2
Joined: Mon Oct 31, 2005 9:09 pm

Post by jagweb »

On the page I want to display it on, all other info is displayed as such

Code: Select all

<center>
<br />
{SUBMITCOMPLETE}<br /><br />

{SUBMITRESULTS}<br/><br/>
{SUBMITBUTTON}<br /><br />

{SUBMITREVIEW}<br /><br />

{PRIVACY}
<br />
</center>

How would insert the foreach statement so it is displayed as {SUBMITRESULTS}. Basically how do I define the foreach?


Sorry I am new to php and have read the tutorials, but they haven't answered my question.
Post Reply