Here is zie problem!
I have a page which is
http://www.mba4consultancy.co.uk/mood.html
it is a questionaire, i have a print and see results button on the mood.html
page, both buttons also submit the data to moodresults.php3 so that they can recieve help. (the page is all about moving home).
this is the print code in moodresults.php3...
//Print command
if ($button == "Print Results") {
echo ("<script language=javascript>");
echo ("window.print()");
echo ("</script>");
}
//end print command
this code is to validate which button was pressed, wever it was the see results button or the print results button,
as you can see from the code if the print results button is pressed then i use the javascript print function.
and also easy to see is that if the see results button is pressed then the print function is ignored.
So whats your problem i hear you all say.
Well like i said, depending on what your responces where to the questions in mood.html the moodresults.php3 script puts out a different responce.
The data is displayed correctly but when the print function kicks in and prints the page. The advice which id dynamically written by PHP is not printed. Its like all the javascript printfunction is doing is printing the UNPROSSED PHP, BUT the whole page is written in PHP with echo commands for the HTML. So it is printing the PHP just NOT the dynamic advice. take a look at it all.
bellow is the moodresults.php3 script...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Mood </TITLE>
</HEAD>
<body bgcolor="#ffffff" text="#000000" id=all>
<?php
//this section decides what advice should be given depending on what answetr they provided for the question
$as=0;
$bs=0;
$cs=0;
if($onea)
{
$as++;
}
if ($oneb)
{
$bs++;
}
if ($onec)
{
$cs++;
}
if ($twoa)
{
$as++;
}
if ($twob)
{
$bs++;
}
if ($twoc)
{
$cs++;
}
if ($threea)
{
$as++;
}
if ($threeb)
{
$bs++;
}
if ($threec)
{
$cs++;
}
if ($foura)
{
$as++;
}
if ($fourb)
{
$bs++;
}
if ($fourc)
{
$cs++;
}
if ($fivea)
{
$as++;
}
if ($fiveb)
{
$bs++;
}
if ($fivec)
{
$cs++;
}
//table header
echo("<table width=100% border=1 cellspacing=3 cellpadding=3 bordercolor=84CEB5>
<tr>
<td bgcolor=bdded6>
<p><font face=Verdana, Arial, Helvetica, sans-serif><b><font size=4>Test
Results </font></b><br>
<font size=2>So how did you do?</font><b> </b></font></p>
</td>
</tr><tr>
<td>
<p><font face=Verdana, Arial, Helvetica, sans-serif size=2>The system has examined
your answers and has concluded the following:</font></p>
</td>
</tr>
");
if (($as>=2)and($as<6))
{
echo("<tr>
//advice responce 1
<td bgcolor=bdded6><font face=Verdana, Arial, Helvetica, sans-serif size=2><B>Our test tells us that you seem quite contented with your current accommodation. You may not need to move, but you may want to because you want a change - theres more about this later</B></font></td>
</tr>");
}
if ($bs>=2 && $bs<6)
{
echo("<tr>
//advice responce 2
<td bgcolor=bdded6><font face=Verdana, Arial, Helvetica, sans-serif size=2><B>We can tell from the test that you seem to be very dissatisfied with your current accommodation. It doesn't meet your needs, not does it appear that it is likely to. It may be time to move<br></B></font></td>
</tr>");
}
if ($cs>=2 && $cs<6)
{
echo("<tr>
//advice responce 3
<td bgcolor=bdded6><font face=Verdana, Arial, Helvetica, sans-serif size=2><B>Is good enough, good enough. Do you need to think about adaptations to your home, or do you think it's time for a change.<BR></B></font></td>
</tr>
");
}
echo("<div align=center><table width=100% border=0 cellspacing=0 cellpadding=0>");
echo("<tr><td><p><font face=Verdana, Arial, Helvetica, sans-serif size=2><BR>But it is not just about practical matters. You may want to be closer to employment, amenities or family and friends. You may want a complete change of scene. Think about the following as a way of refining, re-enforcing, or challenging the options that are beginning to emerge. </font></p></td> </tr>");
echo("<tr><td><p><font face=Verdana, Arial, Helvetica, sans-serif size=2><br>Just Because…</font></p><p><font face=Verdana, Arial, Helvetica, sans-serif size=2>Does the location of your current home</font></p> <table width=88% border=0 cellspacing=0 cellpadding=0 align=center> <tr><td width=8% align=center><b><font face=Verdana, Arial, Helvetica, sans-serif size=2 color=000052>a</font></b></td><td width=92%> <font face=Verdana, Arial, Helvetica, sans-serif size=2>provide you with everything you need socially, culturally, practically e.g. transport, services, employment etc</font></td></tr><tr><td width=8% align=center><b><font face=Verdana, Arial, Helvetica, sans-serif size=2 color=000052>b</font></b></td><td width=92%><font face=Verdana, Arial, Helvetica, sans-serif size=2>make is almost impossible to live your life in the way you want to</font></td></tr>");
echo("<tr><td width=8% align=center><b><font face=Verdana, Arial, Helvetica, sans-serif size=2 color=000052>c</font></b></td> <td width=92%><font face=Verdana, Arial, Helvetica, sans-serif size=2>provide some of the things you need but not without difficulty</font></td></tr></table>");
echo("<p><font face=Verdana, Arial, Helvetica, sans-serif size=2><b>This has been a fairly light hearted way to think about your housing needs and to some degree, aspirations. Clearly, it is important to give more rigorous consideration to the issues. The following section provides an opportunity to examine your current situation more thoughtfully and fully.</b></font></p> </td> </tr>");
echo("<tr><td><p><font face=Verdana, Arial, Helvetica, sans-serif size=2><i><BR>Thinking About Moving?????</i></font></p><p><font face=Verdana, Arial, Helvetica, sans-serif size=2>Thinking about a change of accommodation? It is something most of us think about from time to time. Why do you want to move? Is it because of the area, or the particular accommodation? Have you ever done this before - on your own or with the support of others - and am are prepared for what lies ahead? Do you have the time, the information, the skill/expertise or will I need to think about asking others? Moving house is a major life change and takes into account a variety of issues including access to friends, soft intelligence about new neighbourhoods, realities about public transport, local amenities and other services and not just those included in optimistic directories. If you live with others, do their needs or aspirations differ from your own. Are there physical or other constraints that really do need to be realised?</font></p> </td> </tr> </table> <center><BR><BR><a href=right.html><font face=verdana size=1>home</a></center></div>");
//Print command
if ($button == "Print Results") {
echo ("<script language=javascript>");
echo ("window.print()");
echo ("</script>");
}
//end print command
?>
</BODY>
</HTML>
now goto
http://www.mba4consultancy.co.uk/mood.html and answer the questions thewn click the print button, print the page and youll notice what i mean!
please please help me this has taken so much time!