Page 1 of 1

Formhandler problem

Posted: Mon Dec 07, 2009 1:10 pm
by smordue
I am using a formhandler script for my contact page that is supposed to grab the mailto address from line 9 of a flatfile, but it isn't working, any help?

Code: Select all

<?php
$email = $POST[email];
 
$mailto = <?
            $lines = file('basedata.txt');
            $l_count = count($lines);
            for($x = 0; $x< $l_count; $x++)
            {
            }
            
            echo "" . $lines[9] . "" ;
            ?>;
$mailsubj = "Website Contact Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site contact form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
?>
 
I think my using a php script within a script is my problem.

Re: Formhandler problem

Posted: Mon Dec 07, 2009 1:28 pm
by AbraCadaver
Yeah, you can't do that. Why not just:

Code: Select all

$lines = file('basedata.txt');
$mailto = $lines[9];