HTML Post format problem

Hi, I am trying dynamically populate a HTML form from a text file. I can view the form, but when I try to POST it, I am unable to retrieve any of the data that was entered into the form.
HTML Form Side:

<?php echo ''; $myFile = "text.txt"; $fh =fopen($myFile,'r'); $theData = fgets($fh); fclose($fh); $theData = trim($theData); echo ''; echo ''; echo ''; ?>

for the sendmail.php:

<?php $myFile = "text.txt"; $fh =fopen($myFile,'r'); $theData = fgets($fh); fclose($fh); $value = $_Post[$theData]; $message = "This is the Value Sent to you: ' . $value . '"; $to = '[email protected]'; $email = '[email protected]'; $subject = 'Form'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: ' . $to . "\r\n"; $headers .= 'From: ' . $email . "\r\n"; @mail( $to, $subject, $message, $headers); ?>

Of course this is simplified for only one input, the real use will have multiple input tags. I even have problems when I hard code the Post function with the value that I know is in the text file. Any help and insight is greatly appreciate it. Thank you

Hi there,

I would try removing the space between “name” and “=” in the declaration of that input.

On the same line, try removing the \ from the speech marks.

Plus to actually display the contents of the variable you will need to concatenate:
[php]echo ‘’;

Just wanted to let you know that that changing the name tag from name="$theData" to
name = “’ .$theData. '” worked great, and now the script is working. Thank you

Sponsor our Newsletter | Privacy Policy | Terms of Service