Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-04-2010, 12:55 AM   #1
Bronze Member
 
Join Date: Jan 2010
Location: New York
Posts: 93
Default php form displaying blank page?

I'm new to PHP and I'm trying to create a very simple php email form. How do I get it so that the page does not reload to a blank white page with just a text thank you message?

Link: http://www.katieful.com/contact2.html

HTML Form:
HTML Code:
<form method="POST" name="form" onsubmit="return validate(this)" action="mail.php" accept-charset="utf-8">
                <div>
                    <label for="name">Name</label>
                    <input type="text" name="name" id="name" value="" maxlength="25" />
                </div>
                <div>
                    <label for="org">Organization</label>
                    <input type="text" name="org" id="org" value="" />
                </div>
                <div>
                    <label for="email">Email</label>
                    <input type="text" name="email" id="email" value="" />
                </div>
                <div style="height: 154px;">
                    <label for="message">Is there anything else you want to say?</label>
                    <textarea id="message" name="message" cols="5" rows="2"></textarea>
                </div>
                <input type="submit" class="submit" value="Submit!" style="width: 96px; float:left; margin-top: 8px;" onmouseover="this.className='submithover'" onmouseout="this.className='submit'" />
            </form>
And here's my mail.php:
Code:
<?php 
$name = $_POST['name'];
$email = $_POST['email'];
$org = $_POST['org'];
$message = $_POST['message'];
$formcontent="Hello Katie! You just got an email from Katieful! Happy new client dance! \n\nFrom:$name \nEmail: $email \nOrganization: $org \nMessage: $message";
$recipient = "katie@katieful.com";
$subject = "Katieful Message from $email";
$mailheader = "From: $email rn";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "";
?>
Thanks!
__________________
http://www.katieful.com - Web Design Portfolio of Katie Chin.

http://www.twitter.com/katiechin - Twitter
lolkaykay is offline   Reply With Quote


Old 10-05-2010, 06:25 PM   #2
Bronze Member
 
Join Date: Jan 2010
Location: New York
Posts: 93
Default

Nevermind, I figured it out!
__________________
http://www.katieful.com - Web Design Portfolio of Katie Chin.

http://www.twitter.com/katiechin - Twitter
lolkaykay is offline   Reply With Quote
Old 10-05-2010, 08:34 PM   #3
Silver Member
 
v2Media's Avatar
 
Join Date: Jul 2010
Location: Queensland, Australia
Posts: 119
Default

I wouldn't use that script if I were you. Spambots will have a feast as it's easily exploited to send spam.
__________________
I do Web Design, Brisbane - Gold Coast based.
Spend a lot of time in PHP/MySQL Web Development.
And Search Engine Optimisation chews up the rest.
v2Media is offline   Reply With Quote
Old 10-11-2010, 11:14 AM   #4
New Member
 
Join Date: Sep 2010
Posts: 7
Default

you can redirect in any page using php function header:

header('Location: mypage.html');

better if you test the result of mail function, something like this:

if (mail($recipient, $subject, $formcontent, $mailheader)) {
header('Location: my_success_page.html');
}
else {
header('Location: my_fault_page.html');
}
logoarena is offline   Reply With Quote
Old 10-13-2010, 06:11 PM   #5
New Member
 
Join Date: Oct 2010
Posts: 4
Default

you can link it back to the contact form but since you guess it already it might be useful for other to know how'd you do it.
__________________
See my DrePro's Web Articles for other web topics.
z0alexander is offline   Reply With Quote


Reply

Tags
echo, form, php

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:02 PM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.