Jump to content

Recommended Posts

Posted

Here is my dilema.

 

I am new to PHP but trying like crazy to learn it. I use Dreamweaver to make my webpages so it does alot of the php for me. This is very nice, in that I can use this to help me understand PHP.

 

The problem I am having is that I cannot successfully setup a form using php to send the info via email. I have tried to use the two CGI emailers from the CPanel to no avail. I liked the one (cant remember the name) that allows you to setup the format and then it sends the info in a neat TXT file. But after hours of changing parameters I gave up.

 

I have been reading books and trying to make a PHP form email using my 2 PHP books but I cant seem to get it to work.

 

Is it possible to use the mail() with TCH? I think so since I saw the path to the sendmail server in the CPanel.

 

Also I have read the you must set the location of the mail server in the PHP.ini file in-order for this to work using Linux. Is this setup on the TCH servers?

 

In the past I used Frontpage (oh I hate to say that, since I have been trying out the MFZ (MS Free Zone)) extensions as the form handlers but Dreamweaver does not have these, or atleast I dont know about them.

 

 

If anyone could help me out with this I would greatly appreciate it. I am so new at PHP it seems I stumble at each step in the process until I finally get it to work.

 

Thanks for your help

 

Scott.

Posted

Yes the mail function should work fine -- I use it extensively on my sites here at TCH. Here is how it works:

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

 

If you want to paste in here the actual script(s) that are not working for you, I'd be happy to have a look.

Posted (edited)

Thanks for the link. I was looking at it and I think I need to supply the default location in the mail function, but how do I do that?

 

><html>
<?PHP
$mail_to = "plainj1@bellsouth.net";
$mail_subject = "Hi There";
$mail_body = "We'll have a time PHPing";
$mail_body .= "7 pm friday night";
if(mail(mail_to, $mail_subject, $mail_body))
echo "Successfully send the email  \"$mail_subject\" to $mail_to.";
else echo "Failed to send the email \"$mail_subject\"."

?>

</html>

As you can tell this is just a test script to see if I can get it to work. My thinking was to get this working first before I tackled the forms. :D Basically all it does is send an email when it is run.

 

Thanks for your help MatMan

 

Scott

Edited by MRwisdom12
Posted
I am new to PHP but trying like crazy to learn it.

Thats about were I am with it. :D

 

Here's a tip: Go to your local book store/library and try to find "SAMS Teach Yourself PHP in 24 Hours". It is a very easy to read book that can teach you a lot in a short amount of time. :)

Posted

I looked at that book, but I put it back for the beginners PHP 4 book by Wrox. Will go to morrow and check it out again.

 

Does it explain sending email in forms and connecting to Databases?

Posted

If this is the actual line in your script:

if(mail(mail_to, $mail_subject, $mail_body))

 

It looks like you left out a "$" on your mail_to variable.

 

That will DEFINTITELY not work! :D

 

Oh, and the WROX book is the best. Actually, theirs usually are.

Posted
Does it explain sending email in forms and connecting to Databases?

I'm only on hour 7 but I'll check in the Table of contents...

 

...

 

 

......

 

Ok, Hour 9 - Working with Forms, Hour 12 - Database Integration: SQL. I haven't read them yet so I can't ell you how useful they are to your purpose, but check it out.

Posted

AHHH!!!!! Dude. Thanks so much for the help. That worked. I guess I was looking at the code so long that I was "seeing" the $ infront of the variable when it wasn't there.

 

 

Maybe I should get a book on paying attention to detail..

 

:)

Posted

I hate WROX books. And WROX is also going out of business and not supporting their books.

 

I have Professional PHP Programming. I emailed them to get the code listings, and received return email that they weren't supporting anything anymore as they were no longer going to be in business.

 

--Beth

Posted

Wow, I'm disappointed to hear that. For the last four years or so they've been publishing the best programming books on the planet IMHO.

Posted

I saw that book at Banes and Nobles bethohio3. (Professional PHP programming). I leafed through it at the store for about 15 minutes, and first of all it was over my head in php programming, but I did feel like that particular book was as "neat" as the beginning PHP 4 book that I have. It seemed to jump all over the place. That is of course IMHO.

 

I do like the other Wrox books as well.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...