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
Email validation script is not working?
Old 07-08-2011, 12:32 PM Email validation script is not working?
Average Talker

Posts: 17
Name: Ali Shan
Location: Pakistan, Lahore
Trades: 0
I have inserted an email validation script in my web form but it is not working please help me if you can.
Here is my script with html form and php.
PHP Code:
<html>
<body bgcolor="silver" text="blue" link="black">

<form action="" method="post">
    <table align="center">
        <tbody align="left" valign="top">
        <tr>
        <td height="100"></td>
        </tr>
        <tr>
            <td>
                Name:* </td>
            <td>
                <input type="text" name="Name" value="" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                E-Mail:* </td>
            <td>
                <input type="text" name="E_Mail" value="" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                Phone no:* </td>
            <td>
                <input type="text" name="Ph" value="" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                Ga: </td>
            <td>
                <input type="text" name="Ga" value="" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                Comments:* </td>
            <td>
                <textarea rows="3" cols="20" name="Comments"></textarea>
            </td>
        </tr>
        <tr>
            <td>
            * Required
            </td>
        </tr>
    </table>
    <table align="center">
        <tr>
            <td>
                <input type="submit" value="Submit" alt="submit" name="submit" />
            </td>
            <td>
                <input type="reset" />
            </td>
        </tr>
    </table>
</form>

</body>
</html>
<?php
    
if (isset($_POST["submit"]))
    {
        include(
"data.php");
        
$Name=$_POST['Name'];
        
$E_Mail=$_POST['E_Mail'];
        
$Ph=$_POST['Ph'];
        
$Ga=$_POST['Ga'];
        
$Comments=$_POST['Comments'];
        
        
$error false;
        
        if (
$Name == '' || $E_Mail == '' || $Ph == '' || $Comments == '')
            {
                
$error true;
 
                echo 
"ERROR: Please fill required fields!";
            }
                    
        if(
preg_match("/^[+]{1}[0-9]{12}$/"$Ph)) {
            
$error false;
        }
        else{
            echo 
"The Phone number is not valid.";
        }
                        
        if(
preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/"$E_Mail)) {
            
$error false;
        }
        else{
            echo 
"Your Email is not Valid.";
        }
        
        if(
$error == false){
            
mysql_query("INSERT INTO `gmifamil_form`.`gmi` (Name, EMail, Ph, Ga, Comments) VALUES ('$Name', '$E_Mail', '$Ph', '$Ga', '$Comments')")
            or die(
mysql_error());
            
header("Location: th.htm");
        }
        
    }

?>
DezineGenerators is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-08-2011, 01:21 PM Re: Email validation script is not working?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Keep to ONE thread please.

http://tycoontalk.freelancer.com/php...form-self.html
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-08-2011, 01:36 PM Re: Email validation script is not working?
Average Talker

Posts: 17
Name: Ali Shan
Location: Pakistan, Lahore
Trades: 0
Sorry
DezineGenerators is offline
Reply With Quote
View Public Profile
 
Old 07-13-2011, 08:40 PM Re: Email validation script is not working?
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
You should really make sure you clean that up before blindly dropping in your database.

Reminds me of the old xkcd:
__________________

Please login or register to view this content. Registration is FREE

willcode4beer is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Email validation script is not working?
 

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.20263 seconds with 12 queries