Forum Moderators: coopster
Many thanks to everyone who helped me with my form. It's mostly working and it's printing to pdf.
My client wants to use lots of these forms, I personally think they are monotonous but there you go. Anyways, a more lengthy version linked below just isn't working, I don't know why, the page jsut does not display.
Cam anyone help before I tear all of my hair out?
Ellie
[edited by: coopster at 3:07 pm (utc) on Aug. 28, 2006]
[edit reason]
[1][edit reason] no urls please TOS [webmasterworld.com] [/edit] [/edit][/1]
does your site usually show parse errors in the browser?
you could try adding this to the very top of the script
error_reporting(E_ALL);
that may show the error. If we don't know the error then it is difficult to debug.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <script>
function printWindow(){
bV = parseInt(navigator.appVersion)
if (bV >= 4) window.print()
}
</script>
</head>
<body onload="isReady=true">
<a href="#nav" class="skip" accesskey="2">Skip to Content</a>
<div id="container">
<div id="logo"><img src="images/bannerlogos1.jpg" alt="Blue and white logo for section one" width="475" height="32" /></div>
<a name="nav"></a>
<div id="nocolumn">
<h2>How Reflective Are You?</h2>
<p>Try this quiz </p>
<p>For each of the following statements rate the extent to which it applies to you
with 1 = true, 2 = often the case but not always true, 3 = rarely the case, 4 = not true. Add
up your totals and read the section on, ’Interpreting your score’. Store you results
in your folder.</p>
<?php
if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form
?>
<form method="post" action="<?php echo $PHP_SELF;?>">
<table width="99%" border="0">
<tr>
<td width="80%"><p><strong>Statement</strong></p></td>
<td> <p><strong>Score</strong></p></td>
</tr>
<tr>
<td width="80%"><p>1. I am confident that I will know how to capture and record my own development. </p></td>
<td><input class="form" name="1" wrap="1" type="text" size="5" maxlength="1" /></td>
</tr>
<removed repetetive html -jatar_k>
</tr>
</table>
<input class="form" type="submit" value="submit" name="submit">
</form>
<p class="psmall">© Department of Sociology & ESF </p>
</div>
</div>
<?php
} else {
$1 = $_POST["1"];
$2 = $_POST["2"];
$3 = $_POST["3"];
$4 = $_POST["4"];
$5 = $_POST["5"];
$6 = $_POST["6"];
$7 = $_POST["7"];
$8 = $_POST["8"];
$9 = $_POST["9"];
$10 = $_POST["10"];
$11 = $_POST["11"];
$12 = $_POST["12"];
$13 = $_POST["13"];
$14 = $_POST["14"];
$15 = $_POST["15"];
$16 = $_POST["16"];
$total = $_POST["total"];
echo "<p>answer1:".$1."</p>";
echo "<p>answer2:".$2."</p>";
echo "<p>answer3:".$3."</p>";
echo "<p>answer4:".$4."</p>";
echo "<p>answer5:".$5."</p>";
echo "<p>answer6:".$6."</p>";
echo "<p>answer7:".$7."</p>";
echo "<p>answer8:".$8."</p>";
echo "<p>answer9:".$9."</p>";
echo "<p>answer10:".$10."</p>";
echo "<p>answer11:".$11."</p>";
echo "<p>answer12:".$12."</p>";
echo "<p>answer13:".$13."</p>";
echo "<p>answer14:".$14."</p>";
echo "<p>answer15:".$15."</p>";
echo "<p>answer16:".$16."</p>";
echo "<p>Total - add your score and enter it here:".$total."</p>";
echo "<a href='javascript:printWindow()'><img src='images/print.jpg' height='50' width='45' alt='print this page' border='0' /></a> <a href='intro13pdf.php?1=$1&2=$2&3=$3&4=$4&5=$5&6=$6&7=$7&8=$8&9=$9&10=$10&11=$11&12=$12&13=$13&14=$14&15=$15&16=$16&total=$total'><img src='images/save.jpg' alt='save this page' height='50' width='45' border='0' /></a>";
}
?>
</body>
</html>
[edited by: jatar_k at 3:42 pm (utc) on Aug. 28, 2006]
[edit reason]
[1][edit reason] shortened code [/edit] [/edit][/1]
Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /var/www/html/test.php on line 118
you need to get your host to have those errors coming out. display_errors may be set to 'off' and would need to be changed to 'on'
or your error level is set too low, which my code in my first response would fix
you may want to look at this from the manual
[php.net...]
A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
Yes it was a variables issue, changed them all to words and of course, it worked. Thanks
Just one other query. The form works ok except, the form passes through the form output to fpdf all the text after an apostrophied word just disappears!
In IE, even the print button on output preview doesn't show up - it does in firefox.
[edited by: MsCrow at 1:34 pm (utc) on Aug. 29, 2006]
Using addslashes [us2.php.net] may fix your problem ;)
Best of luck!
<?php
} else {
$which = $_POST["which"];
$why = $_POST["why"];
$outline = $_POST["outline"];
$activities = $_POST["activities"];
$extent = $_POST["extent"];
$comments = $_POST["comments"];
echo "<p><b>Which volunteering organisation have you chosen?</b></p><p>".$which."</p>";
echo "<p><b>Why did you choose this volunteering organisation? For example: Have you had previous experience of working in this area? Is the nature of the work, or the aims of the organisation, of relevance to your degree course? Was your decision to work with this organisation related to a career aspiration?</b></p><p>".$why."</p>";
echo "<p><b>Outline briefly your learning objectives for, and expectations of, your volunteering experience. What do you hope to get out of them? How do you expect to achieve them? </b></p><p>".$outline."</p>";
echo "<p><b>What activities do you envisage you will be doing during your volunteering experience?</b></p><p>".$ideas."</p>";
echo "<p><b>Given your objectives and expectations outlined above, to what extent do you think your volunteering experience will allow you to fulfil these expectations?</b></p><p>".$extent."</p>";
echo "<p><b>Any other comments?</b></p><p>".$comments."</p>";
echo "<p>Once you have started your volunteering things may turn out differently. You may not get what you thought you would but you may gain something different. It is best to stick with it and use the experience constructively. If however you have real concerns contact your tutor for advice</p>";
echo "<a href='javascript:printWindow()'><img src='images/print.jpg' height='50' width='45' alt='print this page' border='0' /></a> <a href='focus2pdf.php?which=$which&why=$why&outline=$outline&activities=$activities&extent=$extent&comments=$comments'><img src='images/save.jpg' alt='save this page' height='50' width='45' border='0' /></a>";
}
?>
It's something to do with the last line with the variables and ' in the form boxes is effecting it. Can anyone help?
I separated out the code into an html form that posts to the php code above, I was told to use <INPUT TYPE="image" SRC="save.jpg" VALUE="Save" ALT="Save now" NAME="Save"> but it makes no difference or HTTP sockets, but I don't understand those either.
I can't bare looking at this php anymore.
Thanks
Ellie