Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 11-29-2002, 08:43 AM ????
ghettocars's Avatar
Defies a Status

Posts: 1,738
Name: Josh
Location: Miami, FL
Trades: 0
ok i need the script to be done so i intended it myself.
when i press submit, it takes me to mail.php and it just displays the source.

what am i doing wrong?

here is an example:

Untitled.htm **

<form action="mail.php" method="post">
Your Name: <input type="text" name="name"><br>
E-mail: <input type="text" name = "email"><br><br>
Comments<br>
<textarea name="comments"></textarea><br><br>
<input type="submit" value="Submit">
</form>


mail.php **

<?php
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$to="josh3316@hotmail.com";
$message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: $email";
if(mail($to,"Comments From Your Site",$message,"From: $email\n")) {
echo ("Thanks for your comments.");
} else {
echo ("There was a problem sending the mail. Please check that you filled in the form correctly.");
}
?>



anyone know? thx in advanced
-JOSH
__________________

Please login or register to view this content. Registration is FREE
ghettocars is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-29-2002, 11:05 AM
ghettocars's Avatar
Defies a Status

Posts: 1,738
Name: Josh
Location: Miami, FL
Trades: 0
nevermind i got it! woooooooo!!!!!!!! it works!

only one problem, i need to redirect it. nevermind though, i can handle that. just some simple JS.
__________________

Please login or register to view this content. Registration is FREE
ghettocars is offline
Reply With Quote
View Public Profile
 
Old 11-29-2002, 04:32 PM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Trades: 0
You can put at the top of the php script:

header("Location: http://www.thepagetogoto.com/page.htm");

which will do the redirect for you.
__________________

Please login or register to view this content. Registration is FREE
- Everything a webmaster needs - for free

Please login or register to view this content. Registration is FREE
- Free web hosts reviewed and rated

Please login or register to view this content. Registration is FREE
- Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile
 
Old 11-29-2002, 05:37 PM
ghettocars's Avatar
Defies a Status

Posts: 1,738
Name: Josh
Location: Miami, FL
Trades: 0
heh cool, i already did it with Javascript though. thanks for your suggestions david.
__________________

Please login or register to view this content. Registration is FREE
ghettocars is offline
Reply With Quote
View Public Profile
 
Old 11-30-2002, 12:03 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Trades: 0
Ghetto I would use his idea. If people have js turned off then it will be messed up. Also it is faster because it is processed before the page is loaded.

Also (php people please confirm this) I beleive that if mail() fails then it will produce an error and therefore you would never see this:
echo ("There was a problem sending the mail. Please check that you filled in the form correctly.");

if you add an @ symbol before any function ( @mail("ect....") ) then it will supress errors.
Good luck.
-dk
__________________
Did I help you? If so, be nice and throw me some
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
dk01 is offline
Reply With Quote
View Public Profile
 
Old 12-02-2002, 09:58 AM
ghettocars's Avatar
Defies a Status

Posts: 1,738
Name: Josh
Location: Miami, FL
Trades: 0
oh, i took off the if statement, it seemed to be causing errors.
and its true, if the mail doesnt send it does give you an error

well, the form design part was easy, i just kept getting the T_Variable error because i needed the:

$name = $_POST('name')

in mail.php.

but its all done now. and, im using david's idea works out great.

thx for the tips guys.
-Josh
__________________

Please login or register to view this content. Registration is FREE
ghettocars is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ????
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22947 seconds with 12 queries