OK, I'll explain exactly what I am trying to do. The filenames are not final yet but here goes.
http://epik.dzepik.com/html/bios.php
Is where a user input all the data into forms.(only optional info so far)
<form method="POST" action="addbios.php">
From there the data goes to addbios.php which adds the data from the forms to a mySQL database.
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "user", "password");
mysql_select_db("dbname",$db);
$sql = "INSERT INTO memberbio (nickname,realname,aim,icq,msn,location,age,hobbies,favmap,favgun,quote) VALUES
('$nickname','$realname','$aim','$icq','$msn','$location','$age','$hobbies','$favmap','$favgun','$quote')";
$result = mysql_query($sql);
include("redirectbios.php");
} else{
// display error
?>
echo "An error has accured.\n";
<?php
} // end if
?>
</body>
</html>
The file redirectbios.php serves as a fancy way (i think) to redirect the user to resultbios.php
The resultbios.php is supposed to take the data from the mySQL database and create a php file named after the inputted nickname in bios.php and create it in /members dir.
<?php
$db = mysql_connect("localhost", "user", "password");
mysql_select_db("db",$db);
$result = mysql_query("SELECT * FROM memberbio",$db);
while ($row = mysql_fetch_array($result)) {
$display_nickname = $row["nickname"];
$display_realname = $row["realname"];
$display_aim = $row["aim"];
$display_icq = $row["icq"];
$display_msn = $row["msn"];
$display_location = $row["location"];
$display_age = $row["age"];
$display_hobbies = $row["hobbies"];
$display_favgun = $row["favgun"];
$display_favmap = $row["favmap"];
$display_quote = $row["quote"];
$filename = "displaybios.php";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
$filename = $display_nickname;
$create = touch("/home/dirtydog/public_html/epik/html/members/$filename.php");
$open = fopen("/home/dirtydog/public_html/epik/html/members/$filename.php",'w');
$write = fwrite($open, $contents);
}
?>
The file displaybios.php is sort of like the template which is copied and supposed to be updated with the variables from resultbios.php
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="37%" height="163" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0">
<tr valign="middle">
<td width="100%" height="20" colspan="2" bgcolor="#9D0000"><b>
<font face="Verdana" size="2"> Required Info</font></b></td>
</tr>
<tr valign="middle">
<td width="32%" height=30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Name:</font></td>
<td width="68%" height="30" bgcolor="#616161">
</td>
</tr>
<tr valign="middle">
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Status:</font></td>
<td width="68%" height="30" bgcolor="#616161">
</td>
</tr>
<tr valign="middle">
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Activity:</font></td>
<td width="68%" height="30" bgcolor="#616161">
</td>
</tr>
<tr valign="middle">
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Email:</font></td>
<td width="68%" height="30" bgcolor="#616161">
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="37%" height="308" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0">
<tr>
<td width="100%" height="20" colspan="2" bgcolor="#9D0000"><b>
<font face="Verdana" size="2"> Optional Info</font></b></td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Nick Name:</font></td>
<td width="68%" height="39" bgcolor="#616161">
<?php
echo $display_nickname;
?>
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Real Name:</font></td>
<td width="68%" height="30" bgcolor="#616161">
<?php
echo $display_realname;
?>
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> AIM/ICQ/MSN:</font></td>
<td width="68%" height="30" bgcolor="#616161">
<?php
echo $display_aim;
echo $display_icq;
echo $display_msn;
?>
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Location:</font></td>
<td width="68%" height="30" bgcolor="#616161">
<?php
echo $display_location;
?>
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Age:</font></td>
<td width="68%" height="30" bgcolor="#616161">
<?php
echo $display_age;
?>
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Hobbies:</font></td>
<td width="68%" height="30" bgcolor="#616161">
<?php
echo $display_hobbies;
?>
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Fav. Maps:</font></td>
<td width="68%" height="30" bgcolor="#616161">
<?php
echo $display_favmap;
?>
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Fav. Guns:</font></td>
<td width="68%" height="30" bgcolor="#616161">
<?php
echo $display_favgun;
?>
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#4B4B4B">
<font face="Verdana" size="2"> Quote:</font></td>
<td width="68%" height="30" bgcolor="#616161">
<?php
echo $display_quote;
?>
</td>
</tr>
</table>
</center>
</div>
This is where im having the problem it creates the file but non of the variables from resultbios.php are displayed.