Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 27th, 2002, 08:15 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Article Discussion: A Simple Feedback Form With PHP

If you have any questions or comments on this article then please post them here.

Reply With Quote
  #2  
Old July 30th, 2002, 02:57 PM
markerdave markerdave is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Illinois, USA
Posts: 71 markerdave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Is it possible to send an html based email with the mail function in php or just text based? Thanks!

Reply With Quote
  #3  
Old July 30th, 2002, 03:22 PM
Lindset Lindset is offline
weirdomoderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Alta, Norway
Posts: 370 Lindset User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to Lindset Send a message via AIM to Lindset
I found this in the manual.

Send these strings in the mail header.

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

Take a look in the manual for further explanation. They have an excellent example.
__________________
Best Regards,
Håvard Lindset

Reply With Quote
  #4  
Old July 30th, 2002, 10:20 PM
markerdave markerdave is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Illinois, USA
Posts: 71 markerdave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Thanks Lindset! That helps a lot. I thought I gave the manual a good look-over, but not good enough it seems. Thanks again.

Reply With Quote
  #5  
Old September 10th, 2002, 04:41 AM
tieubao tieubao is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 4 tieubao User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Please help me ! I get an error

Hi !
I do the same as tutorial "A Simple feedback form with PHP"
But I get theses error :
Warning: Failed to Connect in d:\www\docs\feedback\sendmail.php on line 21

Warning: Cannot add header information - headers already sent by (output started at d:\www\docs\feedback\sendmail.php:21) in d:\www\docs\feedback\sendmail.php on line 22
Please help me to solve this error.
Thank you

Reply With Quote
  #6  
Old September 10th, 2002, 05:47 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Can you please post the code you're having trouble with.

The problem with "Headers already sent..." is because you're outputting something before sending your header(). Make sure you have no blank lines at the top of your script.
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #7  
Old September 11th, 2002, 03:51 AM
tieubao tieubao is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 4 tieubao User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Re: Please help me ! I get an error

Quote:
Originally posted by tieubao
Hi !
I do the same as tutorial "A Simple feedback form with PHP"
But I get theses error :
Warning: Failed to Connect in d:\www\docs\feedback\sendmail.php on line 21

Warning: Cannot add header information - headers already sent by (output started at d:\www\docs\feedback\sendmail.php:21) in d:\www\docs\feedback\sendmail.php on line 22
Please help me to solve this error.
Thank you

Thank Frank for helping me solve problem

Reply With Quote
  #8  
Old February 7th, 2003, 04:27 PM
johnwalton84 johnwalton84 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 johnwalton84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi, I am creating a slightly more advanced form of the feedback script, but it only allows 5 variables to included. Is there any way of increasing this, to say, 10?

Reply With Quote
  #9  
Old February 9th, 2003, 10:15 AM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
John,

Not sure I understand... But why are you only limited to 5 variables? Could you post the code so we can take a look at it.

Reply With Quote
  #10  
Old February 9th, 2003, 11:40 AM
johnwalton84 johnwalton84 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 johnwalton84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
By variables I mean form fields. I've actually rectified the problem by using a different script. But the problem was occuring with the 'mail' part of the PHP script:

<?
mail( "yourname@yourdomain.com", "Feedback Form Results",
$message, $fieldA, $fieldB, $fieldC, "From: $email" );
header( "Location: URL" );
?>

When that form was sumitted there was error something along the lines of "Too many variables, only 5 variables expected in line 2", which was where the mail command was. The script worked fine if the $fieldA, $fieldB and $fieldC fields were removed from the PHP and the form though.

Reply With Quote
  #11  
Old February 9th, 2003, 11:46 AM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Hi John,

Ahh... That actually has to do with PHP's Mail() function.

You are passing too many variables... What you would need to do is embed the extra values, you want to pass, within the $message variable:

$message = $message . "\n\n$var1\n$var2\n$var3\n$var4\n$var5";


That's just one way of doing it... To get a nice output, you need to play around with it...

If you're still interested in modifying the original script you had, let me know, and I'll help you out!

Reply With Quote
  #12  
Old February 9th, 2003, 03:27 PM
johnwalton84 johnwalton84 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 johnwalton84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ah.. right! I knew there would be a simple answer! Thanks. I'm new to PHP, so still have a lot of learning to do Thats okay, i've sorted it out now.

Thanks again
John

Reply With Quote
  #13  
Old February 25th, 2003, 08:41 PM
danke danke is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Huntington, VT
Posts: 10 danke User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question this submit form tutorial

i successfully completed this tutorial, but am not receiveing any emails from it when someone posts to it, can someone try for me?
http://keyworthgraphics.com/feedback.html
it seems to work ok, maybe have a look at the source, i just can't figure out what else might need to be edited...

Reply With Quote
  #14  
Old February 26th, 2003, 07:37 PM
skatablaze skatablaze is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: cincinnati
Posts: 8 skatablaze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to skatablaze
Simple forum , for some reason iv been working on it for an hour and i am at the verge of beating my skull into the monitor.
---------------------------------------------------------------------------
Notice: Undefined variable: message in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 1

Notice: Undefined variable: name in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 1

Notice: Undefined variable: email in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 1

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 1

Warning: Cannot modify header information - headers already sent by (output started at C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php:1) in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 2


I dont get it, the php.ini is set up right and the variables are defined. im not a expert at php, i just need some help.


<<---CODE:-----
|
-------------------[feedback.php]---------------------
<FORM action="sendmail.php" method=post>
<p>Email:<INPUT type="text" name="email">
Comments:<br>
<TEXTAREA name="message" cols="25" rows="7"></textarea>
<br>
<input type=submit value="send">
</FORM>
----------------------------------------------

----------------[sendmail.php------------------------------
<?php mail("shorty40@fuse.net", "Feedback Form Results", "$message", "From: $email");
header("Location: http://skata.kicks-ass.net/feedback/thankyou.php");?>
------------------------------------------------

I'm very sorry for the long Post, but i need help.

Reply With Quote
  #15  
Old February 27th, 2003, 08:42 AM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Wink

Quote:
Originally posted by skatablaze

----------------[sendmail.php------------------------------
<?php mail("shorty40@fuse.net", "Feedback Form Results", "$message", "From: $email");
header("Location: http://skata.kicks-ass.net/feedback/thankyou.php");?>
------------------------------------------------

I'm very sorry for the long Post, but i need help.


This is easily solved, skata.. I'll go down the list for you.

1st) Notice: Undefined variable: message in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 1
This means that the variable $message is not declared anywhere prior to trying to use it.. IE: It has a blank value, or has not been initiated.

2nd) Notice: Undefined variable: name in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 1
This means that the variable $name is not declared.. just like above..

3rd) Notice: Undefined variable: email in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 1
This means that the variable $email is not declared anywhere.. just like above..

4th) Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Documents and Settings\UserX001\My Documents\My Webs\feedback\sendmail.php on line 1

This is really easy to solve... take your code from above:
Quote:
----------------[sendmail.php------------------------------
<?php mail("shorty40@fuse.net", "Feedback Form Results", "$message", "From: $email");
header("Location: http://skata.kicks-ass.net/feedback/thankyou.php[/url]");?>
------------------------------------------------


and change it to this:
PHP Code:
<?php

$mailto 
"shorty40@fuse.net";
$email "Forumfeedback@fuse.net"//This is just for example
$subject "Feedback Form Results";
$mailheaders "From: $email";
$message "This is where your message would go.";

//Now send the email using the above variables

mail($mailto$subject$message$mailheaders);
header("Location: http://skata.kicks-ass.net/feedback/thankyou.php");
?>


And lastly)

add ob_start(); at the beginning of the code

and ob_flush(); at the end.. or just remove all of the spaces before your code

Hope this helps.

Reply With Quote
  #16  
Old February 28th, 2003, 07:10 PM
skatablaze skatablaze is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)