There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Web Design & Development
Tag Cloud
audio bios blue screen boot bsod computer connection crash dell desktop drivers email error excel firefox freeze google hard drive hardware hijackthis install internet laptop linux malware network no sound outlook problem reboot redirect router screen slow sound speakers spyware startup trojan usb video virus vista vundo webcam windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
PHP contact form

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
dgamma3's Avatar
Junior Member with 2 posts.
 
Join Date: Jun 2009
30-Jun-2009, 07:30 PM #1
PHP contact form
hi, I have just finshed making a contact form. in the form the action sends it to a page called send.php. This is my problem:

Code:
if(!preg_match('/^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,6}$/', $to)) {
echo 'bad email' ;
}
when a user enters an incorrect email, it will display the bad email error on the send.php page. This is not want i want it to do.

i want it do display and error above the contact form on the contact page. Like this: HERE. Try enter an incorrect email, it will display a message above the contact form. How do i do this.
Techmonkeys's Avatar
Senior Member with 632 posts.
 
Join Date: Feb 2005
Location: West Yorks
Experience: Advanced
02-Jul-2009, 09:55 AM #2
You would set a variable for the bad email so instead of

Code:
echo 'bad email' ;
you would have

Code:
$bademail = 1;
Then you would have the code at the top of your page something like:

Code:
if ($bademail = 1) {
echo '<font color="#FF0000">Invalid Email Address</font>';
}
So when you click the Submiyt button and it reloads the page then the $bademail is set to one it will display the message at the top of the page
__________________
Regards,
Techmonkey
More free Tech Support and chat available @ www.techmonkeys.co.uk
dgamma3's Avatar
Junior Member with 2 posts.
 
Join Date: Jun 2009
05-Jul-2009, 02:48 AM #3
ok. how would insert this message:
if ($bademail = 1) {
echo '<font color="#FF0000">Invalid Email Address</font>';
}

in a specific cell.
Closed Thread Bookmark and Share

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 12:54 AM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.