Rrrrow!!
The way that I would do this with PHP would be to have a very simple
function on the server to catch and re-display the form submission.
To make it easy, I would simply use the $_REQUEST global as the input
(since that catches POST, GET, and SESSION in one whack).
Make a new text document (in a proper text editor, like BBEdit,
TextWrangler, Coda, TextMate, SubEthaEdit – basically anything with
Geek Cred).
If you are copying this from Mail, be sure that every line below
between the php start end end tags ends in either a curly brace or a
semicolon. Mail loves to line-wrap text, and PHP doesn’t like that so
much.
If you are copying from the Web interface, pay attention to the quote
marks. The smart punctuation module on the Web likes to curl the
quotes for better typographical presentation. It’s supposed to leave
the contents of code blocks alone, but it’s sometimes a little too
helpful and you end up with pretty, but non-functional code.
<?php
$input = array_map('strip_tags',$_REQUEST);
$input = array_map('trim',$input);
$output = "";
foreach($input as $key=>$val){
if($key != 'submit' && !empty($val)){
$out .= ucwords(str_replace('_',' ',$key));
$out .= ': ' . $val . '<br />;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Form Results - Print This Page</title>
</head>
<body>
<div>
<?=$out?>
</div>
</body>
</html>
To use this handler, save it on your server in your Web root
somewhere with a file-type extension of .php, and in Freeway, point
your form at it as the Action. So if you called it ‘handler.php’, and
you put it in the same folder on the server as Freeway publishes the
form page, in the Freeway Form Setup dialog you would enter
‘handler.php’ in the Action field.
You can set the Method to either POST or GET. GET is useful while
debugging, because you can see the variables that are being sent
directly in the URL field of the browser. POST is better in
production because some (cough, Microsoft, cough) browsers don’t do
well with very long GET strings. There is a limit to POST, but it’s
so high as to be unreachable in practice.
Again in Freeway, make sure that your Submit button is named
‘submit’ (the Value is what sets the text on the button, but I have
deliberately hidden any field named ‘submit’ in this script). Each
form field that you want to be displayed on the print view should be
named in lower-case with underscores for spaces, like
‘some_field_name’. The script will remove the underscores and
Uppercase the first letter of each word, so it would display as ‘Some
Field Name’.
That’s it. Upload your Freeway document, and try it out on the server.
Note that this script simply echoes whatever was entered. It does no
validation of any kind, and does rudimentary cleansing of the input
to avoid basic server attacks.
Hope this helps,
Walter
On Jan 29, 2008, at 11:34 AM, Brian Steere wrote:
So many ways to skin the cat!
In the trust that answers often serve more than l’il ol’ me I will
state
that I will choose a host with PHP.
I note that my linklok scripts populate a page template with values
- so I
am aware that these functionalities are enacted via PHP - but the
how to is
less apparent.
It may be that the CSS isn’t too far out for me to approach.
Is the form handler the same skinning technique as via PHP?
In Gratitude
Brian
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options