| 
	
 | 
 Posted by deko on 06/13/06 00:14 
making progress... 
 
> The <?php echo bits cause the form to redisplay what was entered since the  
> only times the user will see the form are a) if this is the first time or b)  
> if there was some error in processing the values supplied to the form. 
 
I was just trying to put the form processing code into a separate file (not echo  
it).  That's more of a managability thing - for troubleshooting, I'll put the  
code in-line. 
 
I'm still having trouble getting the form action working: 
 
<form action="<?php 
   //write to file for testing - production code will send email 
   $message_file = "/home/username/public_html/cgi-bin/messages.txt"; 
   $message = $_POST['message']; 
   $fp_msg = fopen($message_file,"a"); 
   fwrite($fp_msg, $message."\n"); 
   fclose($fp_msg); 
   ?>" method="post" name="feedback" > 
   <textarea name="message" rows="12" cols="22" maxlength="4096"></textarea></p> 
   <input type="submit" value="Send"> 
</form> 
 
The problem is nothing gets written to messages.txt! 
 
The redirect is working, now that I have this code at the very top of the page: 
 
<?php 
$message = $_POST['message']; 
$email = $_POST['email_address']; 
if (!empty($message) && !empty($email)) 
{ 
    header("Location:http://www.mysite.com/send-confirm.php"); 
    exit; 
} 
?> 
 
But does this prevent the form's in-line code in the from running? 
 
Should I put the form action code in just above the redirect? 
 
A couple of other questions: 
 
Is "4096" an acceptable value for maxlength?  That's about a full page of text  
(counting spaces). 
 
Should I use the $_REQUEST['message'] variable?  I've seen this in a couple of  
examples - what is it for? 
 
Thanks!
 
  
Navigation:
[Reply to this message] 
 |