homepage Welcome to WebmasterWorld Guest from 54.196.24.103
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Simple Contact Form Redirect - What Am I Missing?
The contact form works but unable to resolve to thank you page
rusj407




msg:3686021
 4:49 pm on Jun 28, 2008 (gmt 0)

Here is my problem.
I created a simple contact form and right now when I hit send it:
Sends the email, message and information correctly, however it does not resolve to the thank you page.

I know I am missing something but not sure what so I have included a bit of info below: .
From the form: The submit action is below:
<td><input type="submit" name="submit" value="Submit" /></td>

PHP Form Processing File:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
// Pick up the form data and assign it to variables
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];

// Build the email (replace the address in the $to section with your own)
$to = '#*$!#*$!@yahoo.com';
$subject = "New Message: $topic";
$message = "$name said: $comments";
$headers = "From: $email";

// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);

// Redirect
header("Location: [#*$!#*$!x.com...]

?>

Error Message:
Line 19 is the header line:
Warning: Cannot modify header information - headers already sent by (output started at /home/supersk/public_html/#*$!#*$!.com/contact_us/process_form.php:3) in /home/supersk/public_html/#*$!#*$!.com/contact_us/process_form.php on line 19

I feel so stupid and know that it will take seconds for someone to spot my error, back after hours of reading, testing and making zero headway. I thought I would ask for help. (Thanks in advance)
Russ

 

henry0




msg:3686047
 5:32 pm on Jun 28, 2008 (gmt 0)

From the manual
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP

The Manual [php.net] is your best friend

Another solution: Edit your php.ini and allow for output buffering (OB), don't forget to restart Apache.
then you may send any header from where ever :)

rusj407




msg:3686057
 6:24 pm on Jun 28, 2008 (gmt 0)

I will check out the manual the rest just few right over my head. I am a true newbie to php. I was hoping soe one would answer like hey you need to place $ here or ; there.

henry0




msg:3686062
 6:34 pm on Jun 28, 2008 (gmt 0)

it is all explained in the provided link (manual)

and regarding php.ini you may ask your ISP to help you

Best way to learn php is to ask, try, read and look for the how to, not for a canned solution:)

dreamcatcher




msg:3686277
 11:53 am on Jun 29, 2008 (gmt 0)

You need to remove this block of code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

dc

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved