PDA

View Full Version : Php form Help =-/



Exorcist526
August 16th, 2002, 12:19
Im wondering how i would make a php file that would have 3 imput values; First Name, Last Name and E-mail address, then when it submits, i want it to write to a hard text file so my server can come and pick it up. and after it submits go to a designated website. Can someone Please help?!
-Peter

OriginXT
August 16th, 2002, 13:40
well you can do this:


<?php

$include="";
foreach($HTTP_POST_VARS as $a=>$b){
$include.="$a: $b\r\n";
}
$file=fopen("somefile.txt", w+);
fwrite($file,$include);//or it may be file then include...
fclose($file);
?>


if there is a bug, dont tell me... Im a little kid!

Exorcist526
August 16th, 2002, 13:43
Would something like this work?
<?php
$fp = fopen ("myfile.txt", "a");
fwrite ($fp,"$FirstName:$LastName:$Email:".$_ENV["REMOTE_ADDR"]."\n");
fwrite ($fp,"Last Name: $Lastname\nFirst Name: $Firstname\nE-Mail: $email\nIp: ".$_ENV["REMOTE_ADDR"]."\n");
fclose($fp);
header("Location: redirect.to/here.html");
?>

keith
August 16th, 2002, 17:11
Originally posted by granddbz
if there is a bug, dont tell me... Im a little kid!then how do you expect to learn?