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 7197071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:53:59+00:00 2026-05-28T20:53:59+00:00

In Register.php, it contains a form. <html> <body> <form action=Insert.php method=post> Email: <input type=text

  • 0

In Register.php, it contains a form.

<html>
<body>

<form action="Insert.php" method="post">
Email: <input type="text" name="email" /><br/>
Username: <input type="text" name="username" /><br/>
<input type="submit" name="Send Registration" value="Send Registration"/>
</form>

</body>
</html>

In Insert.php, it contain codes that do some validations.

<?php

if(!filter_var($_POST[email], FILTER_VALIDATE_EMAIL))
{
  exit("E-mail is not valid");
}
else
{
  if(!strlen($_POST[username])>=6)
  {
    exit("Username should be at least 6 characters");
  }
  else
  {
    // Continue other validations
  }
}

?>

When i enter an invalid email address a click on ‘send registration’, it will show the error message “E-mail is not valid”.
So, i tried to enter a valid email address and key in 5 or lesser characters in the username field and click on ‘send registration’. But it doesn’t show the error message.

May i know what is wrong with my codes?
Sorry i am a beginner in programming and php.
Thanks in advance!

  • 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-05-28T20:54:00+00:00Added an answer on May 28, 2026 at 8:54 pm

    Your logic is wrong:

    if(!strlen($_POST[username])>=6)
    

    Replace with: *also note the ‘ characters in the variable (The ! negator is replaced with the less than, double negative, this is easier to understand if you have to look through a lot of code, you may miss the “!”

    if (strlen($_POST['username'])<6)
    

    Hope this helps.

    Also something you may want to consider:
    Get rid of “insert.php” and put the code from THAT into the same page as the form. You can do something like this:

    Form: <form method="post" action="'.$self.'">

    (put in the top of the page inside the PHP brackets)

    $self   = $_SERVER['PHP_SELF'];
    $username   = $_GET['username'];
    $email     = $_GET['email'];
    

    It depends on how you want it set up, use either POST or GET, I can’t tell you which to use.

    From here, you can manipulate your variables and whatever.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Jquery: <script type=text/javascript> $(document).ready(function(){ $(form.register).change(function() { $.post(check.php, $(form.register).serialize(), function( data ) { if( data.username
jQuery: $(#register-form).submit(function(event) { event.preventDefault(); $.post(./register.php, { username: $(#username).val(), password: $(#password).val(), passwordtwo: $(#passwordtwo).val(), email: $(#email).val()
I have a form that talks to 'process_register.php' to register a user. That file
I'm trying to validate a php register form using valid8 jquery plugin. i need
So I have this form here: http://www.piataterenuri.info/register.php The problem is that Firefox caches the
Is there anyway to register a PHP callback function to be executed when the
PHP provides a mechanism to register a shutdown function: register_shutdown_function('shutdown_func'); The problem is that
I have PHP configured so that magic quotes are on and register globals are
I have php scripts that do things like register, login, upload. I would like
using register_shutdown_function I can register code to execute at the end of a PHP

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.