Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8354277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:30:07+00:00 2026-06-09T09:30:07+00:00

I am attempting to validate an email address if it already exists in a

  • 0

I am attempting to validate an email address if it already exists in a table, but this isn’t working.

Here’s my code:

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$('#Submit').click(function() {
    var emailVal = $('#email').val(); // assuming this is a input text field
    $.post('checkemail.php', {'email' : emailVal}, function(data) {
        alert(data);
    });
});
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="view.php">
  <p>
    <input type="text" name="email" id="email" />
  </p>
  <p>
     <input type="submit" name="Submit" id="Submit" value="Submit" />
  </p>
</form>
</body></html>

When the Submit button is clicked, it should validate first using the jQuery and call the checkemail.php file as shown below:

<?php
include("../includes/db.php");

$sql = "SELECT email FROM lf_clients WHERE email = " .$_POST['email'];
$select = mysqli_query($con, $sql);
$row = mysqli_fetch_assoc($select);

if (mysqli_num_rows > 0) {
    echo "The email already exists.";
}
?>

However, when I click the submit button it goes to view.php instead of checkemail.php. Before it redirects to view.php, it should check first if the email already exists or not. If the email already exists, then it should not redirect to view.php.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:30:09+00:00Added an answer on June 9, 2026 at 9:30 am
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){ //newly added 
    $('#Submit').click(function() {alert('in');
        var emailVal = $('#email').val(); // assuming this is a input text field
        $.post('checkemail.php', {'email' : emailVal}, function(data) {
            if(data=='exist') return false;
            else $('#form1').submit();
        });
    });});
    </script>
    </head>
    <body>
    <form id="form1" name="form1" method="post" action="view.php">
      <p>
        <input type="text" name="email" id="email" />
      </p>
      <p>
        <input type="button" name="Submit" id="Submit" value="Submit" />
      </p>
    </form>
    </body>
    </html>
    

    php Code

    <?php
    include("../includes/db.php");
    
    $sql = "SELECT email FROM lf_clients WHERE email = " .$_POST['email'];
    $select = mysqli_query($con, $sql);
    $row = mysqli_fetch_assoc($select);
    
    if (mysqli_num_rows > 0) {
        echo "exist";
    }else echo 'notexist';
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to use 'jQuery Validate' on a form that requires an email address
Based on the answer provided here , I am attempting to validate whether or
I have an Email object and am attempting to validate the number of attachments
I am attempting to add embedded documents. I know this syntax is wrong but
I'm attempting to have Javascript validate a user-entered zip code. If it is within
Attempting to get Spring internationalization working. I have used classpath:messages basename, created .properties files
Attempting to use the data series from this example no longer passes the JSONLint
Attempting/struggling to get registration and sign-up working within an active admin project. I have
Alright here is what I am attempting to do. I have a form written
I am attempting to validate my object that encapsulates a list of other objects,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.