Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
fwrite

Posted by bschultz (bschultz), 5 December 2002
I'm trying to get PHP source code to create an html page and "post" it to the server.

Here's the php code 9straight from PHP.net, cuz I'm don't know much about PHP):

<?php
$filename = '11-14.php';
$somecontent = "D1, opponent_team, opponent_score_1st, opponent_score_2nd, opponent_score_3rd, opponent_score_OT, opponent_score_Total, brainerd_score_1st, brainerd_score_2nd, brainerd_score_3rd, brainerd_score_OT, brainerd_score_Total, Abby_Rehberger_goals, Abby_Rehberger_assists, Abby_Rehberger_points, Abby_Rehberger_PP_Goals, Abby_Rehberger_SH_Goals, Abby_Rehberger_Penalties, Abby_Rehberger_Pen_Minutes, Abby_Rehberger_Shots, Jenna_Roberts_goals, Jenna_Roberts_assists, Jenna_Roberts_points, Jenna_Roberts_PP_Goals, Jenna_Roberts_SH_Goals, Jenna_Roberts_Penalties, Jenna_Roberts_Pen_Minutes, Jenna_Roberts_Shots, Aani_Rangen_goals, Aani_Rangen_assists, Aani_Rangen_points, Aani_Rangen_PP_Goals, Aani_Rangen_SH_Goals, Aani_Rangen_Penalties, Aani_Rangen_Pen_Minutes, Aani_Rangen_Shots, Laura_Bernu_Goals, Laura_Bernu_assists, Laura_Bernu_points, Laura_Bernu_PP_Goals, Laura_Bernu_SH_Goals, Laura_Bernu_Penalties, Laura_Bernu_Pen_Minutes, Laura_Bernu_Shots, Molly_Hendrickson_goals, Molly_Hendrickson_assists, Molly_Hendrickson_points, Molly_Hendrickson_PP_Goals, Molly_Hendrickson_SH_Goals, Molly_Hendrickson_Penalties, Molly_Hendrickson_Pen_Minutes, Molly_Hendrickson_Shots,";

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

   // In our example we're opening $filename in append mode.
   // The file pointer is at the bottom of the file hence
   // that's where $somecontent will go when we fwrite() it.
   if (!$fp = fopen($filename, 'a')) {
        print "Cannot open file ($filename)";
        exit;
   }

   // Write $somecontent to our opened file.
   if (!fwrite($fp, $somecontent)) {
       print "Cannot write to file ($filename)";
       exit;
   }
   
   print "Success, wrote ($somecontent) to file ($filename)";
   
   fclose($fp);
                             
} else {
   print "The file $filename is not writable";
}
?>





Posted by bschultz (bschultz), 5 December 2002
Here's for coding for the form:

<?php>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Brainerd Warrior Stats</title>
</head>

<body>

<div align="center">
 <center>
 <table border="0" cellpadding="0" cellspacing="0" width="100%">
   <tr>
     <td width="50%">
     <img border="0" src="http://www.brian-schultz.com/graphics/brainerd.gif" width="61" height="63"></td>
     <td width="50%">
     <img border="0" src="http://www.brian-schultz.com/graphics/brainerd.gif" width="61" height="63" align="right"></td>
   </tr>
 </table>
 </center>
</div>
<p style="margin-top: 0; margin-bottom: 0"><b>Brainerd Warrior Hockey Stats</b></p>
<FORM ACTION="stats.php" METHOD="POST">    <p><select size="1" name="D1">
   <option>Select Date of Game</option>
   <option value="/ghockey/results/11-14.html">Thu 11/14/02      vs Rocori</option>
   <option value="/ghockey/results/11-19.html">Tue 11/19/02      at Alexandria</option>
   <option value="/ghockey/results/11-21.html">Thu 11/21/02      at St. Cloud Tech</option>
   <option value="/ghockey/results/11-22.html">Fri 11/22/02      vs Minnetonka</option>
   <option value="/ghockey/results/11-26.html">Tue 11/26/02      vs Little Falls      </option>
   <option value="/ghockey/results/12-3.html">Tue 12/03/02 at Fergus Falls      </option>
   <option value="/ghockey/results/12-5.html">Thu 12/05/02 vs Bemidji</option>
   <option value="/ghockey/results/12-12.html">Thu 12/12/02      vs Sartell</option>
   <option value="/ghockey/results/12-17.html">Tue 12/17/02      at Willmar</option>
   <option value="/ghockey/results/12-19.html">Thu 12/19/02 at Rocori</option>
   <option value="/ghockey/results/12-26.html">Thu 12/26/02 MN Girls Holiday Cup</option>
   <option value="/ghockey/results/12-27.html">Fri 12/27/02 MN Girls Holiday Cup</option>
   <option value="/ghockey/results/12-28.html">Sat 12/28/02 MN Girls Holiday Cup</option>
   <option value="/ghockey/results/1-2.html">Thu 1/02/03 vs Detroit Lakes</option>
   <option value="/ghockey/results/1-4.html">Sat 1/04/03 at St. Cloud Apollo</option>
   <option value="/ghockey/results/1-7.html">Tue 1/07/03 vs Alexandria      </option>
   <option value="/ghockey/results/1-9.html">Thu 1/09/03 vs St. Cloud Tech</option>
   <option value="/ghockey/results/1-14.html">Tue 1/14/03 at Little Falls</option>
   <option value="/ghockey/results/1-16.html">Thu 1/16/03 at Wadena</option>
   <option value="/ghockey/results/1-21.html">Tue 1/21/03 vs St. Cloud Apollo</option>
   <option value="/ghockey/results/1-23.html">Thu 1/23/03 vs Willmar</option>
   <option value="/ghockey/results/1-25.html">Sat 1/25/03 at Grand Rapids</option>
   <option value="/ghockey/results/1-28.html">Tue 1/28/03 at Sartell</option>
   <option value="/ghockey/results/2-1.html">Sat 2/01/03 vs Moorhead      </option>
   <option value="/ghockey/results/2-8.html">Sat 2/08/03 Section Quarterfinals</option>
   <option value="/ghockey/results/2-11.html">Sat 2/11/03 Section Semi Finals</option>
   <option value="/ghockey/results/2-14.html">Sat 2/14/03 Section Finals</option>


   </select></p>
   <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber2">
     <tr>
       <td align="center" width="252"><b><font size="2">Score</font></b></td>
       <td align="center" width="59"><b><font size="2">&nbsp;1st period</font></b></td>
       <td align="center" width="62"><b><font size="2">2nd period</font></b></td>
       <td align="center" width="58"><b><font size="2">3rd period</font></b></td>
       <td align="center" width="58"><b><font size="2">OT</font></b></td>
       <td align="center" width="67"><b><font size="2">Final Score</font></b></td>
     </tr>
     <tr>
       <td>
       <input type="text" name="<?php opponent_team" size="22" value="type in opp. team name"> <font size="2">
       score by period</font></td>
       <?php htmlText('textBox','abc','size="10" maxlength="10"')<?>;         <td align="center"> <input type="text" name="opponent_score_2nd" size="7"></td>
       <td align="center"> <input type="text" name="opponent_score_3rd" size="7"></td>
       <td align="center"> <input type="text" name="opponent_score_OT" size="7"></td>
       <td align="center"> <input type="text" name="opponent_score_Total" size="7"></td>
     </tr>
     <tr>
       <td><font size="2">Brainerd Score by Period</font></td>
       <td align="center"> <input type="text" name="brainerd_score_1st" size="7"></td>
       <td align="center"> <input type="text" name="brainerd_score_2nd" size="7"></td>
       <td align="center"> <input type="text" name="brainerd_score_3rd" size="7"></td>
       <td align="center"> <input type="text" name="brainerd_score_OT" size="7"></td>
       <td align="center"> <input type="text" name="brainerd_score_Total" size="7"></td>
     </tr>
   </table>
   <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
 <table border="2" cellpadding="2" width="587" style="border-collapse: collapse" bordercolor="#111111" cellspacing="0">


Posted by bschultz (bschultz), 5 December 2002
  <tr>
     <td width="119" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Name</font></td>
     <td width="51" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Goals</font></td>
     <td width="51" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Assists</font></td>
     <td width="42" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Points</font></td>
     <td width="52" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">PP</font></p>
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Goals</font></td>
     <td width="52" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">SH </font></p>
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Goals</font></td>
     <td width="52" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Penalties</font></td>
     <td width="52" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Penalty</font><p style="margin-top: 0; margin-bottom: 0"><font size="2">Minutes</font></td>
     <td width="68" align="center">
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Shots</font></td>
   </tr>
   <tr>
     <td width="119"><font size="2">Abby Rehberger</font></td>
     <td width="51" align="center">
     <input type="text" name="Abby_Rehberger_goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Abby_Rehberger_assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Abby_Rehberger_points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Abby_Rehberger_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Abby_Rehberger_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Abby_Rehberger_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Abby_Rehberger_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Abby_Rehberger_Shots" size="4"></td>
   </tr>
   <tr>
     <td width="119"><font size="2">Jenna Roberts</font></td>
     <td width="51" align="center">
     <input type="text" name="Jenna_Roberts_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Jenna_Roberts_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Jenna_Roberts_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Jenna_Roberts_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Jenna_Roberts_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Jenna_Roberts_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Jenna_Roberts_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Jenna_Roberts_Shots" size="4"></td>
   </tr>
   <tr>
     <td width="119"><font size="2">Aani .

Posted by bschultz (bschultz), 5 December 2002
Rangen</font></td>
     <td width="51" align="center">
     <input type="text" name="Aani_Rangen_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Aani_Rangen_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Aani_Rangen_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Aani_Rangen_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Aani_Rangen_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Aani_Rangen_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Aani_Rangen_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Aani_Rangen_Shots" size="4"></td>
   </tr>
   <tr>
     <td width="119"><font size="2">Laura Bernu</font></td>
     <td width="51" align="center">
     <input type="text" name="Laura_Bernu_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Laura_Bernu_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Laura_Bernu_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Laura_Bernu_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Laura_Bernu_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Laura_Bernu_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Laura_Bernu_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Laura_Bernu_Shots" size="4"></td>
   </tr>
   <tr>
     <td width="119"><font size="2">Molly Hendrickson</font></td>
     <td width="51" align="center">
     <input type="text" name="Molly_Hendrickson_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Molly_Hendrickson_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Molly_Hendrickson_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Molly_Hendrickson_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Molly_Hendrickson_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Molly_Hendrickson_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Molly_Hendrickson_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Molly_Hendrickson_Shots" size="4"></td>
   </tr>
   <tr>
     <td width="119"><font size="2">Mandy Hendrickson</font></td>
     <td width="51" align="center">
     <input type="text" name="Mandy_Hendrickson_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Mandy_Hendrickson_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Mandy_Hendrickson_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Mandy_Hendrickson_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Mandy_Hendrickson_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Mandy_Hendrickson_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Mandy_Hendrickson_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Mandy_Hendrickson_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Hannah Impola</font></td>
     <td width="51" align="center">
     <input type="text" name="Hannah_Impola_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Hannah_Impola_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Hannah_Impola_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Hannah_Impola_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Hannah_Impola_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Hannah_Impola_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Hannah_Impola_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Hannah_Impola_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Hilary Smith</font></td>
     <td width="51" align="center">
     <input type="text" name="Hilary_Smith_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Hilary_Smith_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Hilary_Smith_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Hilary_Smith_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Hilary_Smith_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Hilary_Smith_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Hilary_Smith_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Hilary_Smith_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Erin Holznagel</font></td>
     <td width="51" align="center">
     <input type="text" name="Erin_Holznagel_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Erin_Holznagel_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Erin_Holznagel_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Erin_Holznagel_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Erin_Holznagel_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Erin_Holznagel_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Erin_Holznagel_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Erin_Holznagel_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Alyssa Lewandowski</font></td>
     <td width="51" align="center">
     <input type="text" name="Alyssa_Lewandowski_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Alyssa_Lewandowski_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Alyssa_Lewandowski_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Alyssa_Lewandowski_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Alyssa_Lewandowski_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Alyssa_Lewandowski_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Alyssa_Lewandowski_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Alyssa_Lewandowski_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Samantha Welle</font></td>
     <td width="51" align="center">
     <input type="text" name="Samantha_Welle_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Samantha_Welle_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Samantha_Welle_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Samantha_Welle_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Samantha_Welle_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Samantha_Welle_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Samantha_Welle_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Samantha_Welle_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Megan Owens</font></td>
     <td width="51" align="center">
     <input type="text" name="Megan_Owens_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Megan_Owens_Assists" size="4"></td>
     <td width="42" align="center">


Posted by bschultz (bschultz), 5 December 2002
    <input type="text" name="Megan_Owens_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Megan_Owens_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Megan_Owens_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Megan_Owens_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Megan_Owens_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Megan_Owens_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Jenna Steffen</font></td>
     <td width="51" align="center">
     <input type="text" name="Jenna_Steffen_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Jenna_Steffen_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Jenna_Steffen_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Jenna_Steffen_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Jenna_Steffen_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Jenna_Steffen_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Jenna_Steffen_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Jenna_Steffen_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Emily Dunphy</font></td>
     <td width="51" align="center">
     <input type="text" name="Emily_Dunphy_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Emily_Dunphy_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Emily_Dunphy_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Emily_Dunphy_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Emily_Dunphy_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Emily_Dunphy_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Emily_Dunphy_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Emily_Dunphy_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Katie Diiro</font></td>
     <td width="51" align="center">
     <input type="text" name="Katie_Diiro_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Katie_Diiro_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Katie_Diiro_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Katie_Diiro_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Katie_Diiro_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Katie_Diiro_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Katie_Diiro_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Katie_Diiro_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Nikki Phillips</font></td>
     <td width="51" align="center">
     <input type="text" name="Nikki_Phillips_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Nikki_Phillips_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Nikki_Phillips_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Nikki_Phillips_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Nikki_Phillips_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Nikki_Phillips_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Nikki_Phillips_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Nikki_Phillips_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Emily Lorenz</font></td>
     <td width="51" align="center">
     <input type="text" name="Emily_Lorenz_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Emily_Lorenz_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Emily_Lorenz_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Emily_Lorenz_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Emily_Lorenz_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Emily_Lorenz_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Emily_Lorenz_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Emily_Lorenz_Shots" size="4"></td>
   </tr>
<tr>
     <td width="119"><font size="2">Macala Campbell</font></td>
     <td width="51" align="center">
     <input type="text" name="Macala_Campbell_Goals" size="4"></td>
     <td width="51" align="center">
     <input type="text" name="Macala_Campbell_Assists" size="4"></td>
     <td width="42" align="center">
     <input type="text" name="Macala_Campbell_Points" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Macala_Campbell_PP_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Macala_Campbell_SH_Goals" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Macala_Campbell_Penalties" size="4"></td>
     <td width="52" align="center">
     <input type="text" name="Macala_Campbell_Pen_Minutes" size="4"></td>
     <td width="68" align="center">
     <input type="text" name="Macala_Campbell_Shots" size="4"></td>
   </tr>

 </table>
 <p style="margin-bottom: 0"><b>Goalie stats</b></p>
   <table border="2" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" width="656">
     <tr>
       <td align="center" width="116">
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Name</font></td>
       <td align="center" width="68">
 

Posted by bschultz (bschultz), 5 December 2002
     <p style="margin-top: 0; margin-bottom: 0"><font size="2">Goals </font> </p>
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Against </font> </td>
       <td align="center" width="64">
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Shots </font> </p>
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Faced</font></td>
       <td align="center" width="56">
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Saves</font></td>
       <td align="center" width="72">
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Minutes </font> </p>
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Played</font></td>
       <td align="center" width="56">
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Goals</font></td>
       <td align="center" width="59">
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Assists</font></td>
       <td align="center" width="59">
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Penalties</font></td>
       <td align="center" width="58">
       <p style="margin-top: 0; margin-bottom: 0"><font size="2">Penalty</font><p style="margin-top: 0; margin-bottom: 0">
       <font size="2">Minutes</font></td>
     </tr>
     <tr>
       <td width="116"><font size="2">Mandy Hanson</font></td>
       <td align="center" width="68">
       <input type="text" name="Mandy_Hanson_Goals_Against" size="6"></td>
       <td align="center" width="64">
       <input type="text" name="Mandy_Hanson_Shots_Faced" size="6"></td>
       <td align="center" width="56">
       <input type="text" name="Mandy_Hanson_Saves" size="6"></td>
       <td align="center" width="72">
       <input type="text" name="Mandy_Hanson_Minuets_Played" size="6"></td>
       <td align="center" width="56">
       <input type="text" name="Mandy_Hanson_Goals" size="6"></td>
       <td align="center" width="59">
       <input type="text" name="Mandy_Hanson_Assists" size="6"></td>
       <td align="center" width="59">
       <input type="text" name="Mandy_Hanson_Penalties" size="6"></td>
       <td align="center" width="58">
       <input type="text" name="Mandy_Hanson_Pen_Minutes" size="6"></td>
     </tr>
     </table>
 <p style="margin-bottom: 0"><b>Team Stats</b></p>
   <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber2">
     <tr>
       <td align="center" width="252"><font size="2"><b>Shots on Goal by Period</b></font></td>
       <td align="center" width="59"><b><font size="2">&nbsp;1st period</font></b></td>
       <td align="center" width="62"><b><font size="2">2nd period</font></b></td>
       <td align="center" width="58"><b><font size="2">3rd period</font></b></td>
       <td align="center" width="58"><b><font size="2">OT</font></b></td>
       <td align="center" width="67"><font size="2"><b>Total Shots</b></font></td>
     </tr>
     <tr>
       <td>
       <font size="1">
       <input type="text" name="opponent_team_" size="22" value="type in opp. team name">
       Shots by period</font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="opponent_shots_1st" size="7"></font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="opponent_shots_2nd" size="7"></font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="opponent_shots_3rd" size="7"></font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="opponent_shots_OT" size="7"></font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="opponent_shots_Total" size="7"></font></td>
     </tr>
     <tr>
       <td><font size="1">Brainerd Shots by Period</font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="brainerd_shots_1st" size="7"></font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="brainerd_shots_2nd" size="7"></font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="brainerd_shots_3rd" size="7"></font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="brainerd_shots_OT" size="7"></font></td>
       <td align="center">
       <font size="1">
       <input type="text" name="brainerd_shots_Total" size="7"></font></td>
     </tr>
   </table>
 <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
 <p style="margin-top: 0; margin-bottom: 0"><font size="2">Brainerd PP (goals)
 </font>
 <input type="text" name="Brainerd_Power_Play_Goals" size="6"><font size="2">&nbsp;for
 </font>
 <input type="text" name="Brainerd_Power_Play_Attempts" size="6"><font size="2">&nbsp;
 (attempts)</font></p>
 <p style="margin-top: 0; margin-bottom: 0"><font size="2">Opponents PP (goals)&nbsp;
 </font>
 <input type="text" name="Opponents_Power_Play_Goals" size="6"><font size="2"> for
 </font>
 <input type="text" name="Opponents_Power_Play_Atempts" size="6"><font size="2"> (attempts)</font></p>
 <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
 <p style="margin-top: 0; margin-bottom: 0"><b>Comments / quotes:&nbsp;</b>Please list ALL scoring summaries
 <textarea rows="4" name="Comments_and_Quotes" cols="62"></textarea></p>
 <p style="margin-top: 0; margin-bottom: 0"><input type="submit" value="Submit" name="B1"></p>
 <p style="margin-top: 0; margin-bottom: 0"><font size="2">powered by CTC
 internet</font></p>
 <p style="margin-top: 0; margin-bottom: 0">
 <img border="0" src="http://www.brainerdwarriors.org/graphics/ctc.jpg" width="94" height="21"></p>
</form>

</body>

<?>


All I get as an output on 11-14.php is the names of the form text boxes, not the contents of the text box.  Also, the file 11-14.php needs to be on the serer already, while I'd like to have the script create it for me.

Any thoughts?  I live in a small town, and the bookstore didn't have a "PHP for Dumbies" book and the library didn't have anything either.

Thanks in advance for the help

Posted by admin (Graham Ellis), 6 December 2002
Goodness - huge question  

I'm giving a Perl course in Plymouth today ... dialing in via modem and paying by the minute for the hotel line ....  I'll have a look at this over the weekend, but if you're able to post a shorter example that includes text to show me the question that would help hugely

Posted by bschultz (bschultz), 6 December 2002
I can't seem to get the text that is typed in the text box to write to the generated file.  All that is generated is the text box names.

For example, go to http://www.brainerdwarriors.org/sports/ghockey/statstest.htm

and fill in some of the fields.  Then, go to http://www.brainerdwarriors.org/sports/ghockey/11-14.php

and you will see the output of the fwrite script.  

Like I said earlier, I'm am VERY new to php, and I live in a small town, with no PHP books in the library or the bookstore.

Thanks, Graham

Posted by admin (Graham Ellis), 7 December 2002
Think you need $-s in front of each of the strings in double quotes, as they look like variable names ... so that

Code:
$somecontent = "D1, opponent_team, opponent_score_1st, opponent_score_2nd, opponent_score_3rd, opponent_score_OT, opponent_score_Total, brainerd_score_1st, brainerd_score_2nd, brainerd_score_3rd, brainerd_score_OT, brainerd_score_Total, Abby_Rehberger_goals, Abby_Rehberger_assists, Abby_Rehberger_points, Abby_Rehberger_PP_Goals, Abby_Rehberger_SH_Goals, Abby_Rehberger_Penalties, Abby_Rehberger_Pen_Minutes, Abby_Rehberger_Shots, Jenna_Roberts_goals, Jenna_Roberts_assists, Jenna_Roberts_points, Jenna_Roberts_PP_Goals, Jenna_Roberts_SH_Goals, Jenna_Roberts_Penalties, Jenna_Roberts_Pen_Minutes, Jenna_Roberts_Shots, Aani_Rangen_goals, Aani_Rangen_assists, Aani_Rangen_points, Aani_Rangen_PP_Goals, Aani_Rangen_SH_Goals, Aani_Rangen_Penalties, Aani_Rangen_Pen_Minutes, Aani_Rangen_Shots, Laura_Bernu_Goals, Laura_Bernu_assists, Laura_Bernu_points, Laura_Bernu_PP_Goals, Laura_Bernu_SH_Goals, Laura_Bernu_Penalties, Laura_Bernu_Pen_Minutes, Laura_Bernu_Shots, Molly_Hendrickson_goals, Molly_Hendrickson_assists, Molly_Hendrickson_points, Molly_Hendrickson_PP_Goals, Molly_Hendrickson_SH_Goals, Molly_Hendrickson_Penalties, Molly_Hendrickson_Pen_Minutes, Molly_Hendrickson_Shots,";

becomes
Code:
$somecontent = "$D1, $opponent_team, $opponent_score_1st, $opponent_score_2nd, $opponent_score_3rd, $opponent_score_OT, $opponent_score_Total, $brainerd_score_1st,

and so on.

A word or caution - this appearance of variables directly in your PHP script if you complete a form is default behaviout in PHP up to and including release 4.1.x, but as from release 4.2.0 it has to be turned on in the php.ini file if you must have it.   MUCH better to style the variables $_POST["opponent_score_TOTAL"] or similar; that will work from PHP 4.1.0 onwards, and removes a security hole that is was easy for the unwary programmer to fall into in previous versions of PHP.

I might suggest you get hold of an appropriate book - I live in a small town too but Amazon still deliver.   I know it's hard to know which book to order on line, but if you can let me know whether you've programmed before in any language(s), and if so which, I can tell you what my favourites would be.  There's also a list of the books we have on our own shelves at http://www.wellho.net/resources/phpbooks.html

Posted by admin (Graham Ellis), 13 December 2002
Hey, bschultz, can you please follow up / complete the loop on this one? Did I guess at what the problem was, or was it something else of have you chosen to go a different route?  Would be great to complete the thread with the answer?

TIA of your follow up

Posted by bschultz (bschultz), 14 December 2002
$_POST["content string here"]

did the trick....but now I need to figure out how to get the layout of the template to stay intact so that the text box text shows up in the column instead of just listing the resulting text as "1, , , ,2 ,"   etc.  I have some reading to do.  

Been printing the manual at php.net for the last week.  It's over 2000 pages long, and won't print by just hitting print...the file is too big.  Have to print sections at a time.

Thanks Graham



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho