Forum Moderators: coopster
Can any help me? What I want to do is simple but I can't find anything to help aside from a little php that doesn't help.
I have a form with three text areas, I would like this form, when submit is clicked, to take the user to an HTML formattable output page of the heading of the text areas and the info the user typed in, a preview page if you will. It will be so the user can print the formatted output and file it in their student logs. Or they can save the html output file.
I found a php script that does output to a php file, with the headings and results, only I don't know how to format the php to accept my external css file.
Any help appreciated, I have a headache from searching for options!
Ellie
Here is an example of what I was doing...Any solution is welcome but for a linus server
<?php
$prefer = $_POST["prefer"];
$develop = $_POST["develop"];
$challenge = $_POST["challenge"];
if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form
?>
<!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>
<title>Personal INFO</title>
<link rel="StyleSheet" href="style.css" type="text/css" />
</head>
<body>
<form method="post" action="<?php echo $PHP_SELF;?>">
<p>Which opportunity do you prefer and why?
<textarea rows="5" cols="20" name="prefer" wrap="physical"></textarea>
<br />
How could you use this opportunity to develop yourself?
<textarea rows="5" cols="20" name="develop" wrap="physical"></textarea>
<br />
What might challenge you?
<textarea rows="5" cols="20" name="challenge" wrap="physical"></textarea>
<br />
</p>
<input type="submit" value="submit" name="submit">
</form>
<?
include "<link rel='StyleSheet' href='style.css' type='text/css' />";
} else {
echo "<p>Which opportunity do you prefer and why?</p> ".$prefer." <br />";
echo "Which opportunity do you prefer and why?<br /> ".$develop." <br />";
echo "Which opportunity do you prefer and why?<br /> ".$challenge." <br /></p>";
}
?>
[edited by: MsCrow at 10:43 pm (utc) on Aug. 17, 2006]
<!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>
<title>Personal INFO</title>
<link rel="StyleSheet" href="style.css" type="text/css" />
</head>
<body>
<?php
if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form
?>
<form method="post" action="<?php echo $PHP_SELF;?>">
<p>Which opportunity do you prefer and why?
<textarea rows="5" cols="20" name="prefer" wrap="physical"></textarea>
<br />
How could you use this opportunity to develop yourself?
<textarea rows="5" cols="20" name="develop" wrap="physical"></textarea>
<br />
What might challenge you?
<textarea rows="5" cols="20" name="challenge" wrap="physical"></textarea>
<br />
</p>
<input type="submit" value="submit" name="submit">
</form>
<?php
} else {
$prefer = $_POST["prefer"];
$develop = $_POST["develop"];
$challenge = $_POST["challenge"];
echo "<p>Which opportunity do you prefer and why?</p> ".$prefer." <br />";
echo "Which opportunity do you prefer and why?<br /> ".$develop." <br />";
echo "Which opportunity do you prefer and why?<br /> ".$challenge." <br /></p>";
}
?>
</body>
</html>
Thank you
[edited by: dreamcatcher at 6:38 am (utc) on Aug. 18, 2006]
[edit reason]
[1][edit reason] No urls as per TOS [webmasterworld.com] Thanks. [/edit] [/edit][/1]
<?php
} else {
$prefer = $_POST["prefer"];
$develop = $_POST["develop"];
$challenge = $_POST["challenge"];
echo "<p><b>Which opportunity do you prefer and why?</b></p><p>".$prefer."</p>";
echo "<p><b>Which opportunity do you prefer and why?</b></p><p>".$develop."</p>";
echo "<p><b>Which opportunity do you prefer and why?</b></p><p>".$challenge."</p>";
}
?>
I have another question, is it possible to add a print button into the php? I have inserted one that is cross browser compatible but it's not doing anything, or appearing. The link above has the current version, here is the code:
<?php
} else {
$prefer = $_POST["prefer"];
$develop = $_POST["develop"];
$challenge = $_POST["challenge"];
echo "<div id='container'><div id='logo'><img src='images/bannerlogos1.jpg' alt='Blue and white logo for section one' width='475' height='32' /></div>";
echo "<div id='nocolumn'><h2>What is employability?</h2>";
echo "<p><b>Which opportunity do you prefer and why?</b></p><p>".$prefer."</p>";
echo "<p><b>Which opportunity do you prefer and why?</b></p><p>".$develop."</p>";
echo "<p><b>Which opportunity do you prefer and why?</b></p><p>".$challenge."</p>";
echo "<Script Language='Javascript'>function printit(){if (window.print) {window.print(); } else { var WebBrowser = '<object id='WebBrowser1' width=0 height=0 classid='clsid:8856F961-340A-11D0-A96B-00C04FD705A2'></object>'; document.body.insertAdjacentHTML('beforeEnd', WebBrowser); WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = ''; }}</script>";
echo "<Script Language='Javascript'> var NS = (navigator.appName == 'Netscape'); var version = parseInt(navigator.appVersion); if (version > 3) { document.write('<form><input type=button value='Print this Page' name='Print' onClick='printit()'></form>'); } </script>";
echo "</div></div>";
}
?>
Is there a way to force the 'save as' dialogue box across browsers that will save the page as .html rather than php? This is so that the user can save the processed form as open it later.
You can see what I'm trying to do in <removed> and the silly save as javascript is useless.
[edited by: jatar_k at 6:00 pm (utc) on Aug. 22, 2006]
[edit reason]
[1][edit reason] no urls thanks [/edit] [/edit][/1]