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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:41:03+00:00 2026-06-03T14:41:03+00:00

Ok: I have HTML code such as: <form method=post> <ul> <li> <label for=username>Username</label> <input

  • 0

Ok: I have HTML code such as:

<form method="post">
  <ul>
    <li>
      <label for="username">Username</label>
      <input type="text" id="username" size="30" onblur="checkUser()" />
      <div id=user></div>
    </li>
    <li>
      <label for="email">Email</label>
      <input type="text" name="email" id="email" size="30" />
    </li>
    <li>
      <label for="first_name">First Name</label>
      <input type="text" name="first_name" id="first_name" size="30" />
    </li>
    <li>
      <label for="last_name">Last Name</label>
      <input type="text" name="last_name" id="last_name" size="30" />
    </li>
    <li>
      <label for="cell">Cell</label>
      <input type="text" name="cell" id="cell" size="30" />
    </li>
    <li>
      <label for="street">Street</label>
      <input type="text" name="street" id="street" size="30" />
    </li>
    <li>
      <label for="city">City</label>
      <input type="text" name="city" id="city" size="30" />
    </li>
    <li>
            <label for="zip">Zip</label>
      <input type="text" name="zip" id="zip" size="30" />
    </li>
    <li>
            <label for="password">Password</label>
      <input type="password" name="password" id="password" size="30" />
    </li>
    <li><label for="password2">Repeat Password</label>
      <input type="password" name="password2" id="password2" size="30" />
    </li>
    <li>
            <label for="submit"></label>
      <button type="submit" name="submit" id="submit">Register</button>
    </li>
  <ul>
</form>

with a JS function

function checkUser()
{   
    var userID=document.getElementById('username').value;
    alert(userID);
    createRequest();
    var url= "userCheck.php?username="+userID;
    //alert(url);
    request.open("GET",url,true);
    request.onreadystatechange=updatePage;
    request.send(null);
}

I’m stuck at document.getElementById('username').value;. The alert says the value is username.

I’m trying to pull the value from said text box with this function and pass it to userCheck.php for a query to see if the username is already used.

Any help?

UPDATE – The rest of the code

<? include "heading.php" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php
function mailer($to,$username,$hash){

        $subject = "Test mail";
        $message = "http://www.me.com/verify.php?username=$username&hash=$hash";
        $from = "me@myself.com";
        $headers = "From:" . $from;
        mail($to,$subject,$message,$headers);
        echo "Mail Sent.";

    }

if(isset($_POST['submit'])){
        if($_POST['password']==$_POST['password2'] && !empty($_POST['password']) && !empty($_POST['username']) && !empty($_POST['email']) && !empty($_POST['last_name'])){
            if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])){
                $msg = 'The email you have entered is invalid, please try again.';  
                }else{
                    require_once "UserManagement.php";
                    $hash = md5(rand(0,1000));
                    $usman=new UserManagement();
                    $usman->createUser($_POST['username'],$_POST['email'],$_POST['first_name'],$_POST['last_name'],$_POST['cell'],$_POST['street'],$_POST['city'],$_POST['zip'],md5($_POST['password']),$hash);
                    mailer($_POST['email'],$_POST['username'],$hash);
                    $msg = 'Your account has been made, <br /> please verify it by clicking the activation link that has been send to your email.';  
                    header('Location: http://www.me.com/me');
                    }
                    }else{
                        $msg = 'Form Data Incorrect';
                        sleep(10);
                        header('Location:http://www.me.com/me');

                    }
}

?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registration</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/templatemo_style.css" rel="stylesheet" type="text/css" />




<script language="javascript" type="text/javascript">
function clearText(field)
{
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}
</script>

<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js">

/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<script type="text/javascript">

ddsmoothmenu.init({
    mainmenuid: "templatemo_menu", //menu DIV id
    orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
    classname: 'ddsmoothmenu', //class added to menu's outer DIV
    //customtheme: ["#1c5a80", "#18374a"],
    contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script>

</head>
<body id="sub_page">
<div id="templatemo_wrapper">
    <div id="templatemo_top">
        <div id="templatemo_login">
        <?include "loginbox.php"?>
        </div>
    </div> <!-- end of top -->

    <div id="templatemo_header">
        <div id="site_title"><h1><a href="http://www.spaladonna.com">SPA LaDonna</a></h1></div>
        <div id="templatemo_menu" class="ddsmoothmenu">
            <? include "mainmenu.php" ?>
        </div> <!-- end of templatemo_menu -->
    </div> <!-- end of header -->
    <? include "checkuser.php"?>
    <div id="templatemo_main">
        <div id="templatemo_content">
            <div class="col_fw">
                <h1>Register User</h1>

                <fieldset>
                    <legend>New User Signup</legend>
                    <form method="post">
                        <ul>

                                <li><label for="username">Username</label>
                                <input type="text" id="username" size="30" onblur="checkUser()" />
                                <div id=user >   </div>
                                </li>

                                <li><label for="email">Email</label>
                                <input type="text" name="email" id="email" size="30" />
                                </li>

                                <li><label for="first_name">First Name</label>
                                <input type="text" name="first_name" id="first_name" size="30" />
                                </li>

                                <li><label for="last_name">Last Name</label>
                                <input type="text" name="last_name" id="last_name" size="30" />
                                </li>

                                <li><label for="cell">Cell</label>
                                <input type="text" name="cell" id="cell" size="30" />
                                </li>

                                <li><label for="street">Street</label>
                                <input type="text" name="street" id="street" size="30" />
                                </li>

                                <li><label for=city">City</label>
                                <input type="text" name="city" id="city" size="30" />
                                </li>

                                <li><label for="zip">Zip</label>
                                <input type="text" name="zip" id="zip" size="30" />
                                </li>

                                <li><label for="password">Password</label>
                                <input type="password" name="password" id="password" size="30" />
                                </li>

                                <li><label for="password2">Repeat Password</label>
                                <input type="password" name="password2" id="password2" size="30" />
                                </li>

                                <li><label for="submit"></label>
                                <button type="submit" name="submit" id="submit">Register</button>
                                </li>

                        <ul>
                    </form>
                </fieldset>
<script type="text/javascript">
var request=null;
function createRequest()
{
    try{

        request= new XMLHttpRequest();

        }catch(tryMicrosft){
            try{
                request= new ActiveXObject("Msxml2.XMLHTTP");

            }catch(otherMicrosoft){
                try{

                        request=new ActiveXObject("Microsoft.XMLHTTP");
                }catch(failed){

                    request=null;
                }
            }   
        }
        if(request==null)
        alert("Error creating request object!");
//else alert("Successfully created");
}

function checkUser()
{   
    var userID=document.getElementById('username').value;
    alert(userID);
    createRequest();
    var url= "userCheck.php?username="+userID;
    //alert(url);
    request.open("GET",url,true);
    request.onreadystatechange=updatePage;
    request.send(null);
}
function updatePage()
{
    if(request.readyState==4)
    replaceText('user',request.responseText);
}

function clearText(el) {
  if (el != null) {
    if (el.childNodes) {
      for (var i = 0; i < el.childNodes.length; i++) {
        var childNode = el.childNodes[i];
        el.removeChild(childNode);
      }
    }
  }
}


function replaceText(el, text) {
  if (el != null) {
    el=document.getElementById(el);
    clearText(el);
   //setTimeout("alert("HELLO")", 4000);


    var newNode = document.createTextNode(text);

   el.appendChild(newNode);




  }
}

</script>
                </div>
<div class="col_fw_last">                 

                <div class="col_w300 float_l">

                </div>

                <div class="col_w300 float_r">

                </div>

                <div class="cleaner"></div>
            </div>  
        </div> <!-- end of content -->

        <div id="templatemo_sidebar">
        <h4>Categories</h4>
            <div class="sidebar_box">
                <ul class="templatemo_list">
                    <li><a href="#">Aliquam pretium porta odio</a></li>
                    <li><a href="#">Integer sit amet erat sit</a></li>
                    <li><a href="#">Nunc elementum mollis</a></li>
                    <li><a href="#">Quisque dictum pharetra</a></li>
                </ul>
            </div>

            <div class="cleaner h40"></div>

            <h4>Cool Links</h4>
            <div class="sidebar_box">
                <ul class="templatemo_list">
                    <li><a href="http://www.templatemo.com" target="_parent">Free CSS Templates</a></li> 
                    <li><a href="http://www.flashmo.com/page/1" target="_parent">Flash XML Galleries</a></li>
                    <li><a href="http://www.flashmo.com" target="_parent">Flash Templates</a></li>
                    <li><a href="http://www.webdesignmo.com/blog" target="_parent">Web Design Resources</a></li>
                </ul>
            </div>
            <div class="cleaner h40"></div>
                <h4>Latest Updates</h4>
                <div class="news_box">
                    <a href="#">Donec eu orci dolor</a>
                    <p>Pellentesque in nunc quam. Sed molestie ultricies ante, vel scelerisque diam varius sed. </p>
                </div>
                <div class="news_box">
                    <a href="#">Aliquam bibendum vulputate</a>
                    <p>Auris nisl mi, aliquet ac lobortis ut, tincidunt in tortor nisl vitae lectus dapibus pellentesque.</p>
                </div>
                <div class="news_box">
                    <a href="#">Nunc viverra vestibulum </a>
                    <p>Nunc viverra vestibulum magna, nec dignissim turpis rhoncus tincidunt. Donec ac nibh arcu. </p>
                </div>
                <div class="news_box">
                    <a href="#">Fusce placerat ultrices</a>
                    <p>Integer ac ultricies nisi. Curabitur velit ante, porttitor ac feugiat a, porta ut lectus.</p>
                </div>
        </div> <!-- end of sidebar -->

        <div class="cleaner"></div>
    </div> <!-- end of main -->
</div> <!-- end of wrapper -->

<div id="templatemo_footer_wrapper">
    <div id="templatemo_footer">
        Copyright © 2012 <a href="#"></a>
        <div class="cleaner"></div>
    </div>
</div> 

</body>
</html>
<? ob_flush(); ?>

and the header.php

<? ob_start(); ?>
<?php 
session_start(); 
$_SESSION['url'] = $_SERVER['REQUEST_URI'];
if(isset($_POST['login'])){
        require_once "UserManagement.php";
        $usman=new UserManagement();
        if($usman->authenticate($_POST['username'],md5($_POST['password']))){
                header('Location: http://www.me.com')
        }else {
                echo "Authentication error";
                echo '<a href="index.php">Home</a>';            
        }
        die();
}
?>

i can post all the menus and stuff too if need be

  • 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-03T14:41:05+00:00Added an answer on June 3, 2026 at 2:41 pm

    Yea – so it was definately a ID 10 T error on my part – i was calling loginbox.php and didnt realize that it was setting a value to the ID=’username’ as the actual word “Username” as a place holder

    changed the one on the form to id=’newuser’ and etc – boom all is well

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

Sidebar

Related Questions

I have the following html code : <form name=uploadForm action= method=POST enctype=multipart/form-data> <input type=file
I have an html input field, such as <form method=post action=process.php enctype=multipart/form-data> <div> <h3>Files:</h3>
Please see the form HTML code below <form method=post action=register> <div class=email> Email <input
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
For example, in the following HTML ... <form name=outerform> <input type=text name=outer1/> <input type=text
So I got this form: <form action=welcome.php method=post> <input type=hidden name=secret value=<?php echo getMyValue()
I have this html form echo <form name='delete_article_form.$row['id'].' action='sources/public/article_processor.php' method='POST' >; echo <input name='processor_switcher'
I have iframe with with form elements such as input, select textarea etc. I

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.