Need help connecting variables
Posted: Sun Mar 25, 2007 9:18 pm
feyd | Please use
When my html file includes chatfile.txt, displaying it, it doesn't display the Displayname and the Chatinput. I'm pretty sure the only reason this doesn't work is because of the way I connected the variables. Can anyone help me?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This is my index.phpCode: Select all
<html><Body>
<form action="ChatFile.php" method="POST">Display Name <input type="text" name="displayname" />Your message <input type="text" name="chatinput" /><br /><input type="submit" value="Submit Message" /></form></center>
<?php include("chatFile.txt"); ?>
</body></html>
This is my ChatFile.php
<?php $myFile = "chatFile.txt";
$whitespace = ": ";
$whitespaces = "\n";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "$displayname $whitespace $chatinput $whitespaces";
fwrite($fh, $stringData);
fclose($fh);
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]