This is a discussion on "[SOLVED] PHP Contact Form" within the PHP Forum section. This forum, and the thread "[SOLVED] PHP Contact Form are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] PHP Contact Form
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
[SOLVED] PHP Contact Form
Hello,
I am new to php and am having a slight problem. The contact form I have on my website is submitted through php. When the user clicks 'Submit', the send.php page displays a message which tells the user if the form was submitted correctly or if s/he entered something wrong. It works fine except that all the HTML after the php code is missing. In other words, the php overwrites anything that comes after it. My code is:
Any help would be much appreciated. Thanks, SWagner
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
|
|
|
|
||||
|
Re: PHP Contact Form
It's because you're calling the exit() function on an error, this stops the script and won't put anything else out.
Or do you mean that it won't display when everything validates? If this is the case, try wrapping all the variables you use between double quotes ie. " in curly braces to make sure PHP isn't getting confused amongst the special characters. PHP won't overwrite anything as it works from top to bottom, you may wish to check your error long to be sure there aren't any hard-to-see sytax errors. Let me know how you go. Cheers,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: PHP Contact Form
OK, I see what you mean. However, the exit(), or die(), function is needed so that the incomplete email is not sent to me. How do I still use the exit()/die() function without the rest of my page being cut off?
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Last edited by Stuart; Oct 13th, 2007 at 20:21. |
|
||||
|
Re: PHP Contact Form
Okay, instead of exiting on error, just store the errors in an array to output. This will allow you to check error before sending mail...
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: PHP Contact Form
Thanks. It works great.
SWagner PS: Why did you replace almost every space with a '*'?
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
|
|
||||
|
Re: PHP Contact Form
I didn't put the asterix there
That's really weird.. sorry about that.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: PHP Contact Form
That's ok. I just used the 'Find and Replace' option in Dreamweaver to replace any asterisk with a space...
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
|
|
|||
|
Re: PHP Contact Form
Also, I have several checkboxes in my form. The problem is that only one of the values (if more than one is checked) is sent to me by email. Why is that, and how do I fix it?
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
|
|
||||
|
Re: PHP Contact Form
Checkboxes all have to have a different name or else the last one will overwrite the previous one.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: PHP Contact Form
OK, thanks.
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] PHP contact form problem | fl0w | PHP Forum | 12 | Jan 31st, 2008 17:56 |
| [SOLVED] PHP contact form redirect to same form | Posie | PHP Forum | 14 | Jan 29th, 2008 20:28 |
| [SOLVED] Wordpress contact form - getting 404 on send | Aso | PHP Forum | 3 | Jan 25th, 2008 11:23 |
| [SOLVED] PHP Contact Form | Stuart | PHP Forum | 8 | Dec 4th, 2007 17:42 |
| [SOLVED] Contact Form Help | danny322 | PHP Forum | 3 | Nov 7th, 2007 16:05 |