Display text from browser (form textfield) to a text files

Links for php scripts

Moderators: macek, egami, gesf

ill2000m
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Mar 29, 2003 8:38 am

Display text from browser (form textfield) to a text files

Postby ill2000m » Sun Mar 30, 2003 6:52 am

i have wriiten a form and a php script and hope once i type anything in the text field text e.g if i type "reset" in the textfield and the word"reset" would produce in a text file ??

however i keep getting the error msg

Parse error: parse error, unexpected T_VARIABLE in /home/free-users/ill2000m/try.php on line 8


below shows the coding for my form (the file is called try.html)

<html>
<title>yeah</title>
<body>

<form action="try.php" method="POST">
type here: <input type="text" name="name" size="20" />

<input type="submit">
</form>
</body>
</html>

and my php script shows below (the file is called try.php)

<html>
<title>form</title>
<script language ="php">

$text = $_POST["totext"]


$topost = "<p>$text</p>"



$fp5 = fopen("textfile.txt", 'a');
fwrite($fp5, $topost);
fclose($fp5);
</script>

<body>
yes yes
</body>
</html>

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Sun Mar 30, 2003 12:12 pm

every line must end with a ;

User avatar
MithikoS
New php-forum User
New php-forum User
Posts: 8
Joined: Sun May 11, 2003 7:56 pm
Location: London
Contact:

Postby MithikoS » Sun May 11, 2003 8:17 pm

second ...

you start with <?php and you ending with ?>

eg.

<?php
$hello = "HELLO2";
echo "HELLO";
echo $hello;

echo "<table><tr><td>HELLO</td></tr></table>";
?>

You can use it... like that

<?php
echo "Hello";
?>
HTML ....
<?php
echo "Hello again";
?>


Now if you have to use html inside the php code you need to do that

<?php
echo "<table><tr><td width='100%'>Hello</td></tr><table>";

echo "OR..... ";

echo "<table><tr><td width=\"100%\">Hello</td></tr><table>";

?>

gl


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest

cron