4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Mail-form in php
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
phryxus
Junior WebHelper
Junior WebHelper


Joined: 16 Nov 2003
Posts: 46

PostPosted: Sat Jan 24, 2004 5:37 pm (13 years, 9 months ago) Reply with QuoteBack to Top

I created a mail form and it just won't work. He doesn't give an error, but when you try to send an e-mail I doesn't get receive one.

This is the form (PS. the variable names are Dutch!):
Code:

<FORM name="contact" action="./handle_form.php" method=post>
 <FONT class="text_bold">Name</FONT><BR>
 <INPUT type="text" name="naam" size=30><BR>
 <FONT class="text_bold">E-mail</FONT><BR>
 <INPUT type="text" name="email" size=30><BR>
 <FONT class="text_bold">Comments</FONT><BR>
 <TEXTAREA name="commentaar" cols="40" rows="7"></TEXTAREA><BR>
 <INPUT type="submit" name="submit" size="30" value="Send">
 <INPUT type="reset" name="reset" size="30" value="Reset">
</FORM>


This is the script that handles the form:
Code:

<?php
 // verwerking form
 $naam = trim ("$naam");
 $email = trim ("$email");
 $commentaar = trim ("$commentaar");
 $email = "From: $email";
 // verzenden form + message
 if (mail ("contact@phryxus.nl", $naam, $email, $commentaar) ) {
  print ("<FONT class=text_bold>$naam,</FONT><BR><FONT class=text>Thank you for sending your email! We will contact you as soon as possible.</FONT>\n");
 } else {
  print ("Your e-mail hasn't been send! Please try again.\n");
 }
?>


THNKZ for your time,
Phryxus
OfflineView User's ProfileFind all posts by phryxusSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sat Jan 24, 2004 5:49 pm (13 years, 9 months ago) Reply with QuoteBack to Top

Check out the PHP manual:

http://www.php.net/manual/en/function.mail.php

That's not the correct syntax for the mail() command Wink

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
phryxus
Junior WebHelper
Junior WebHelper


Joined: 16 Nov 2003
Posts: 46

PostPosted: Sat Jan 24, 2004 7:23 pm (13 years, 9 months ago) Reply with QuoteBack to Top

Ah, thnx! I'm still a rooky with PHP. Wink
OfflineView User's ProfileFind all posts by phryxusSend Personal Message
tomda
Junior WebHelper
Junior WebHelper


Joined: 23 Jan 2004
Posts: 6
Location: Nairobi

PostPosted: Mon Jan 26, 2004 6:05 am (13 years, 8 months ago) Reply with QuoteBack to Top

Also, you may need to find out from your server the mail function that they are using as for example, my server doesn't recognize the mail() function. I should use email () instead (see below)

Fast copy and paste to help you :

<?php
if (!empty($ton)){ //check if email address field is empty
$from="webmaster";
$sujet="A friend ($na) sent you this page ";
$msg="A friend ($na) has sent you this email. Follow the link below and blah blah";

if(!email($from,$ton,$sujet,$msg))
{echo "<span id=dSc>The email has not been send. Please contact the administrator.<br><a href='javascript:window.close()'>Close the window</a>.<hr align='center' noshade size='2' width='650'>";}

else {echo "<span id=dSc>The email has been sent. <br>";
echo "<a href='javascript:window.close()'>Close the window</a> or send this page to another person.<hr align='center' noshade size='2' width='650'>";}}

Tommy
OfflineView User's ProfileFind all posts by tomdaSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Mon Jan 26, 2004 6:16 am (13 years, 8 months ago) Reply with QuoteBack to Top

Hosts who use that function are rare - I presume you are hosted at online.fr?

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
tomda
Junior WebHelper
Junior WebHelper


Joined: 23 Jan 2004
Posts: 6
Location: Nairobi

PostPosted: Mon Jan 26, 2004 7:13 am (13 years, 8 months ago) Reply with QuoteBack to Top

>> Hosts who use that function are rare - I presume you are hosted at online.fr?

Indeed Daniel !

Que penses-tu de leur service ?
En tout cas leur prix bas toute concurrence (si je ne me trompe pas) ?

Tommy
OfflineView User's ProfileFind all posts by tomdaSend Personal Message
phryxus
Junior WebHelper
Junior WebHelper


Joined: 16 Nov 2003
Posts: 46

PostPosted: Mon Jan 26, 2004 2:52 pm (13 years, 8 months ago) Reply with QuoteBack to Top

thnx 4 u're help. I've got him working Laughing
I'm not really sure what the problem was! I think the problem was that I didn't used the right possitions in my mail tag.
OfflineView User's ProfileFind all posts by phryxusSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Mon Jan 26, 2004 5:42 pm (13 years, 8 months ago) Reply with QuoteBack to Top

tomda: Ce que j'ai lu sur leur service n'était pas trop positif, alors j'ai préféré aller ailleurs, d'autant plus que j'ai besoins de services qui ne sont pas disponibles chez eux. Par ailleurs je n'ai pas le temps de modifier tous mes scripts pour utiliser la fonction email() (je ne vois pas pourquoi je m'amuserais à les modifier à chaque changement d'hébergeur!), donc hors de question d'aller chez eux. A mes débuts sur le web, j'y avais tout de même pensé Wink. Enfin à part ça leur offre à l'air tout à fait correcte Smile.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
SfCommand
Senior WebHelper
Senior WebHelper


Joined: 10 Nov 2002
Posts: 143
Location: UK

PostPosted: Mon Jan 26, 2004 10:30 pm (13 years, 8 months ago) Reply with QuoteBack to Top

Don't make me break out teh babelfish to translate all that (or even worse, attempt to translate it myself Very Happy)

________________________________
Miguel

http://community.34sp.com
http://www.miguel.me.uk | http://www.sfcommand.co.uk | http://www.ssdg.org.uk
OfflineView User's ProfileFind all posts by SfCommandSend Personal MessageVisit Poster's Website
tomda
Junior WebHelper
Junior WebHelper


Joined: 23 Jan 2004
Posts: 6
Location: Nairobi

PostPosted: Tue Jan 27, 2004 8:35 am (13 years, 8 months ago) Reply with QuoteBack to Top

Sorry for that Sfcommand... I now it is Embarassed to have post in other language than English but we were speaking about the services of a French server.

Tommy
OfflineView User's ProfileFind all posts by tomdaSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.054489 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme