![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Webforms help
Hi.
I have php GormGenerator installed on on of my websites. I installed it via my CpanelX control panel. The thing is, when I get an email from someone using the form on my site- it comes in like this: Quote:
Quote:
Also I want the "From" field to display the senders email address, not phpFormGenerator@nks.... as it's making my work harder since I need to manually input the clients email address into the "to" field when replying. Go easy with me please; I know VERY little about php and only the basics really of HTML. Thanks for any help given. |
||
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#3 (permalink) |
|
Design Team Member
|
Re: Webforms help
ALRIGHT - ready to help.
Email can be as simple or as complex as you want, really. For instance, my web site's contact form checks EVERY field and makes sure they're not blank, processes the fields through a cuss filter and replaces those words with asterisks (takes the wind out of the sails of some idiot wanting to send a bunch of profanity for their own chuckles), makes sure each field entry is up to a certain amount of characters (I typically want at least 10 characters for a message - I don't count spaces or astericks), and I have a script that verifies that the email exists (although obviously you can't check if they're giving you their REAL email). If they don't meet the requirements I've set, I have the script send back to the review page and it asks them to fill it in. Until they do, it'll keep sending back. It also logs every IP and I will be writing a additional script process that logs the IP after every sent email - and make it so they can't send another email for another 15 minutes or so. So you get my point: it can get really complicated depending on how far you want to take it. I'm going to do a fairly simple one for you that is not nearly as advanced...but it'll still check if the email exists and strip HTML code (a must have for ANY posted variables). Take note of the bolded file name above the code - you need to copy the code into notepad or whatever editor you like and save it as that filename. --------------------- function_checkEmail.php PHP Code:
contact.html HTML Code:
<Form method="post" action="sendmail.php"> <p>Name:<br /> <input name="name" type="text" id="name" size="20" maxlength="50" /> </p> <p>Email:<br /> <input name="email" type="text" size="20" maxlength="50" /> <br /> <br /> Message:<br /> <textarea name="message" rows="5" cols="40"> </textarea> <br /> <input name="Submit" type="submit" value="Submit"> <label> <input type="reset" name="Submit2" value="Reset" /> </label> <br /> </p> </form> sendmail.php PHP Code:
*Please use the updated code below* Last edited by carsey; 09-10-2007 at 02:31 PM. Reason: User request |
|
|
|
|
|
#4 (permalink) |
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
Cheers for that. I will try it and post my experiences with it.
Two questions though;
I have a thank you page working on the site just now :) Last edited by ralen; 09-09-2007 at 07:07 PM. |
|
|
|
|
|
#5 (permalink) |
|
Design Team Member
|
Re: Webforms help
How about I just reformat sendmail.php to make it easier for you to edit...
sendmail.php (version 2) PHP Code:
|
|
|
|
|
|
#6 (permalink) | |
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
Quote:
![]() Its 1am here now, but tomorrow morning Im going to try this out and see how I get on with it. I will keep you informed of my progress. Thanks very much. |
|
|
|
|
|
|
#7 (permalink) | |
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
OK; So I couldnt wait lol.
Ive just tried it out, but Im getting this error after clicking the submit button: Quote:
If you click here you can see the temp upload I've done to test it out. It should redirect to here after the form is submitted. I have added into line 12 the following: Any ideas where I've gone wrong? |
|
|
|
|
|
|
#8 (permalink) |
|
Design Team Member
|
Re: Webforms help
You didn't do anything wrong - I forgot to end the top variables.
PHP Code:
|
|
|
|
|
|
#9 (permalink) | ||
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
Quote:
Heres whats on the line 35: Quote:
|
||
|
|
|
|
|
#10 (permalink) |
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
I've just realised; the script is actually working as I've received the mails, including yours. It's just the error with the redirect after the form has been submitted.
|
|
|
|
|
|
#11 (permalink) |
|
Design Team Member
|
Re: Webforms help
It works on my server.
The error recieved on your page is when something is already posted to the page before the header (header = redirect). The trouble is, there's nothing in the code I gave you that puts anything on the page. Here's what I'm seeing when I copied the source code on your sendmail.php: HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> </body> </html> <br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/puezq/public_html/3g-codes/sendmail.php:8) in <b>/home/puezq/public_html/3g-codes/sendmail.php</b> on line <b>35</b><br /> </body> </html> The good thing is that it does send the email when the address is valid...but try taking out this: PHP Code:
Beyond that, I'm going to have to research this...it's a new one for me. |
|
|
|
|
|
#13 (permalink) |
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
Let me get this right. Is this all that should be in the sendmail.php document:
PHP Code:
PHP Code:
?
|
|
|
|
|
|
#14 (permalink) | ||
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
Quote:
Quote:
![]() Whilst im on the subject of this script; is there anyway I can obtain the persons IP address who is submitting the form? I would like it so that the senders IP address is included in the email I receive. |
||
|
|
|
|
|
#15 (permalink) | |
|
Design Team Member
|
Re: Webforms help
Ah, so that's it. What you have there at the top is the header information - that should not be there. This is just a straight PHP script.
Quote:
Here's the updated script (maybe now we'll get where we wanna go! :P) PHP Code:
Last edited by Redcore; 09-11-2007 at 01:31 AM. Reason: woops...I keep including my darn email... |
|
|
|
|
|
|
#16 (permalink) | |
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
Well the IP address add-in works perfect. But I'm still getting this error:
Quote:
|
|
|
|
|
|
|
#18 (permalink) | ||
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
Quote:
I've changed it now, but it's still not working. However I do notice this change in the error msg given now: Quote:
Don't know if that means anything to you?
Last edited by ralen; 09-11-2007 at 06:17 PM. |
||
|
|
|
|
|
#20 (permalink) | |
|
Registered User
Join Date: Sep 2007
Location: United Kingdom
Posts: 75
OS: XP Media Center
|
Re: Webforms help
Quote:
Here they are; see for yourself: sendmail.php.zip function_checkEmail.php.zip (Because this forum doesnt allow uploading of .php files, I added a ".zip" extension on the end, just remove it). Last edited by ralen; 09-11-2007 at 08:42 PM. Reason: spelling error |
|
|
|
|
![]() |
| Thread Tools | |
|
|