Hello, recently I have been working on a simple script that allows you to input data into a form and then creates a .html page with that data on it. I think i have it mostly working, but for some reason there is an error while creating the page. Here is my code:
Form Page (game_record.php):Data Process Page (game_process.php):PHP Code:<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form id="game_records" name="game_recorder" method="post" action="game_process.php">
Page Title:
<br />
<input type="title" name="textfield" />
<br />
<br />
Filename:
<br />
<input type="filename" name="textfield" />
<br />
<br />
Team Names:
<br />
<input name="team1" type="text" />
<br />
<input name="team2" type="text" />
<br />
<br />
Winning Team:
<br />
<input name="win" type="text" />
<br />
<br />
Score:
<br />
<input name="score" type="text" />
<br />
<br />
Game Links:
<br />
<input name="game1" type="text" />
<br />
<input name="game1" type="text" />
<br />
<input name="game1" type="text" />
<br />
<br />
<input type="submit" />
</form>
</body>
</html>
I hope that is enough to find the problem, if not just post back saying what you need and I will get that to you ASAP. ThanksPHP Code:<?
require("includes.php");
$filename = $_REQUEST['filename']; //Get filename
//Add title
$title = stripslashes($_POST['title']);
//Add team1
$team1 = stripslashes($_POST['team1']);
//Add team2
$team2 = stripslashes($_POST['team2']);
//Add winning team
$win = stripslashes($_POST['win']);
//Add score
$score = stripslashes($_POST['score']);
//Add game 1
$game1 = stripslashes($_POST['game1']);
//Add game 2
$game2 = stripslashes($_POST['game2']);
//Add game 3
if($game3 = stripslashes($_POST['game3'])) {
$add = '
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>'.$title.'</title>
</head>
<body>
</b>Game Stats for game with '.$team1.' vs '.$team2.'</b>
<br />
<br />
Match Score: '.$score.'
<br />
Winning Team: '.$win.'
<br />
Game Links:
<ul>
<li><a href="'.$game1.'">'.$game1.'</a></li>
<li><a href="'.$game2.'">'.$game1.'</a></li>
<li><a href="'.$game3.'">'.$game3.'</a></li>
</ul>
';
$game = $add;
$file = @fopen($filename, "w+");
@fwrite($file, $game);
@fclose($file);
$message = $success;
}
else {
$message = $add_error;
}
echo'
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="5;url=game_record.php">
<title>Status</title>
</head>
<body>
'.$message.'
</body>
</html>
';
?>



Reply With Quote


Bookmarks