Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Adding email validation
Old 12-10-2009, 06:30 PM Adding email validation
Super Talker

Posts: 115
Name: Not Telling
Trades: 0
I would also like to add a email validation to it. How would I go about doing that without messing up the coding?

So basically even if the whole form is filled out, and the email is in the wrong format, then do the same thing as when the form isn't totally filled out. If the email is in the correct format but the whole form isnt filled out, then show an error message, I already have all that coded in, exept the email validation.

Can someone add that to my code?

PHP Code:
<?php
$form 
'<form action="" method="POST">
Email Address:
<input size="40" type="text" value="' 
$_POST["email_address"] . '" name="email_address"><br>
Username
<input size="40" type="text" value="' 
$_POST["username"] . '" name="username"><br>
password
<input size="40" value="' 
$_POST["password"] . '" type="text" name="password"><br>
<input id="submit" class="submit-button" type="submit" name="submit" value="Reset Password" >
</form>'
;
if (isset(
$_POST['submit'])) {
$blank_inputs 0;
$test_array array_count_values($_POST);
$blank_inputs $test_array[""];
if (
$blank_inputs 0) {
//display an error message and put the form back up for editing
echo "Please fill out the whole form.<hr>";
echo 
$form;
} else {
echo 
'message sent';
}
} else {
echo 
$form;
}
?>
__________________
MY MSN:
Please login or register to view this content. Registration is FREE

PHP, HTML, and CSS Coding, Logo and Web Design - Professionally done.
PM me anytime for HTML, PHP or web design help. I will be glad to help you out.
sith717 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-11-2009, 03:29 AM Re: Adding email validation
Experienced Talker

Posts: 48
Name: Pieter
Location: Holland
Trades: 0
<?php
$form
=
'<form action="" method="POST">
Email Address:
<input size="40" type="text" value="'
. $_POST["email_address"] .
'" name="email_address"><br>
Username
<input size="40" type="text" value="'
. $_POST["username"] .
'" name="username"><br>
password
<input size="40" value="'
. $_POST["password"] .
'" type="text" name="password"><br>
<input id="submit" class="submit-button" type="submit" name="submit" value="Reset Password" >
</form>'
;
if (isset(
$_POST['submit'
])) {

if (!empty($_POST['email_address']) && !empty($_POST['username']) && !empty($_POST['password']))
{
$blank_inputs = 1;
}

if (
$blank_inputs > 0
) {
//display an error message and put the form back up for editing
echo "Please fill out the whole form.<hr>"
;
echo
$form
;
} else {
echo
'message sent'
;
}
} else {
echo
$form
;
}
?>
elcosmo is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Adding email validation
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.51646 seconds with 12 queries