There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Web Design & Development
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze gaming gpu hard drive hardware hdmi internet laptop malware memory monitor motherboard music network obp operating system printer problem ram registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
PHP contact form

Reply  
Thread Tools
dgamma3's Avatar
Junior Member with 2 posts.
 
Join Date: Jun 2009
30-Jun-2009, 08: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 633 posts.
 
Join Date: Feb 2005
Location: West Yorks
Experience: Advanced
02-Jul-2009, 10: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, 03:48 AM #3
ok. how would insert this message:
if ($bademail = 1) {
echo '<font color="#FF0000">Invalid Email Address</font>';
}

in a specific cell.
Reply

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.

Search Tech Support Guy

Find the solution to your
computer problem!




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



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:02 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.