Jump to content

dennisvdz

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by dennisvdz

  1. The subject said it. How to do that? If possible without any other .css file.
  2. I'v got a file, that have this inside. <?php $filename = 'store.txt'; $somecontent = "Name: " . $_POST["name"] . "\n"; // 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 (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Redirecting"; fclose($handle); } else { echo "The file $filename is not writable"; } ?> <html> <script language='JAVASCRIPT' type='TEXT/JAVASCRIPT'> <!-- if ((navigator.appName=="Microsoft Internet Explorer") || (navigator.appName=="Netscape")) { if (navigator.appName=="Microsoft Internet Explorer") window.location = "index.php"; else window.location = "index.php"; } else window.location = "index.php"; //--></script> </html> It works fully, but I want, if the thingy '$_POST["name"]' contains notting, notting get added to the page store.txt too. Thank you. D
  3. I did just found it out (myself, wow). It aren't the quotes, but it must be closed and with a dot. whatever. $somecontent = "Name: " . $_POST["name"] . "\n";
  4. Ok. I tried this stuff: SITE - store.txt - add.php - index.php ERROR: Parse error: parse error, unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/www/testserver/add.php on line 3 FILES: store.txt: Empty add.php: <?php $filename = 'store.txt'; $somecontent = "Name: $_POST["name"] \n"; // 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 (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } ?> index.php: <html> <body> <form action="add.php" method="post"> Name: <input type="text" name="name" /> <input type="submit" /> </form> </body> </html> Does someone knows whats wrong? .
  5. Aha. I understand fwrite() now a bit. I actually don't know anything about connecting them. I found this about sumbit. How can I activate a pice of PHP code, that takes the value into the box 'text' with it? <html> <body> <form action="Something.php" method="post"> Text: <input type="text" name="text" /> <input type="submit" /> </form> </body> </html>
  6. I'm quite new in PHP, so I want a example only. Please don't post any parts, becouse I can learn only if I see a code and self find what ever line does . Can someone make me a little example script, that will add every time, someone presses on a button, the text, that is containing in the textbox, get added above a .txt file? Like [TEXTBOX] [bUTTON] [TXT FILE: END TXT FILE] If I will type 'Hi' in the textbox, and then press on the button, it will be like this: [TEXTBOX] [bUTTON] [TXT FILE: Hi END TXT FILE] If I will type now 'Rofl' in the box, and press again, it will be like this: [TEXTBOX] [bUTTON] [TXT FILE: Rofl Hi END TXT FILE] But if I typed notting in the textbox, notting happens too when I press the button. If it's possible, it would be fine if, when the button has been pressed, you will get redirected to the page 'succes.php' Thank you, Dennis.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.