Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not exactly clear on what you're trying to do here. I <em>think</em> you want to fill out the html form and have the php script save the new input into a file on the server, and then print out the contents of the file. If that's correct, here are a few things you need to fix.</p> <p>1) On your html page, the <code>&lt;form&gt;</code> tag must enclose all of the input fields you want to post back to the server. so:</p> <pre><code>&lt;form method="post" action="savewar.php"&gt; &lt;table border="0" id="table1" align="center" cellspacing="0" cellpadding="3" width="100%"&gt; &lt;tr&gt; &lt;td width="50%" valign="top"&gt;&lt;b&gt;Home Clan:&lt;/b&gt; &lt;input type="text" id="clan1" name="clan1" onchange="nomewar();"/&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Opponent Clan: &lt;/b&gt; &lt;input type="text" id="clan2" name="clan2" onchange="nomewar();"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;input type="submit" Value="Generate Table" style="height:70px;width:800px" /&gt; &lt;/form&gt; </code></pre> <p>2) In your php script, you need to use the superglobal $_POST or $_REQUEST variable to catch the data from the posted form. For example:</p> <pre><code>$clan1 = $_POST['clan1']; $clan2 = $_POST['clan2']; </code></pre> <p>3) In your php script, you need to open the file for writing and append the new data to the end of the file:</p> <pre><code>$fileappendpointer = fopen("war/filedb.txt",'a'); $newline = $clan1 . " - " . $clan2 . "&lt;br&gt;"; fwrite($fileappendpointer, $newline); </code></pre> <p>4) Then you can easily read out the contents of the file:</p> <pre><code>fclose($fileappendpointer); $filereadpointer = fopen("war/filedb.txt",'r'); $contents = fread($filereadpointer,filesize("war/filedb.txt")); fclose($filereadpointer); print $contents; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload