Solved: php forms + help

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

catalepsic

Thread Starter
Joined
Jan 15, 2006
Messages
10
I know very little of php but I can manage. I need some assistance with some code.
I want the code to save the results from a form to a file (this code is running from this same file) any help will greatly apreciated.


<html><head><title></title>


</head>
<body bgcolor="#ffffff" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$url = $_POST['url'];
$file = "guestbook.php";
$contents = writetofile($name, $email, $urll);
$openit = fopen ($file, "r+");
fwrite($openit, $contents);
function writetofile($name, $email, $url)
{ ?>
<table><tr><td bgcolor="#cccccc"><?php echo $name; ?></td></tr>
<tr><td><?php echo $email; ?></td></tr>
<tr><td><?php echo $url; ?></td></tr></table><?php
}
?>
</body></html>
 
Joined
Jul 8, 2002
Messages
14,681
Are you saying you want the PHP script to write to its own file? I don't think that's going to work. Any reason you can't just write the data to a separate .txt file, then use require() to print the contents of that text where you need it.
 

catalepsic

Thread Starter
Joined
Jan 15, 2006
Messages
10
NO it does not have to be to the same file, but thats the aproach I took. Guess thats why it does not work corectly. Thanks.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top