value in div from php, reloading form

value in div from php, reloading form

I am having one form with name and username as 2 field. In this i am checking whether the username is available or not, what I want is to dislay the message in the same line as username text box aligned,while showing message it shd show previously filled values also. I have taken two forms login.php in which i am building form and login2.php in which i am showing the value if not registered .but what is happening is I am getting two forms visible on the same page, i want to omit the first one when i go woth other

login.php

<?php 
include 'login2.php';
function form($name, $username)
{
?>
<form name="mylogin" method="post">
<table>
<tr><td>Name</td>
<td><input type="text" id="name" name="name" value="<?php echo $name?>" required></td></tr>
<tr><td>Username</td>
<td><input type="text" id="user" name="user" value="<?php echo $username?>" required></td>
<tr><td><input type="submit" name="submit" value="Username Availability Check"></td></tr>
<?php usercheck()?>
</table>
</form>
<?php
}
?>

<?php
form('','')
?>


login2.php

<?php 
function connect()
{
    mysql_connect('localhost','root','vivaksha');
    mysql_select_db('loginprac');
}
function usercheck()
    {
        if(isset($_POST['submit']))
        {
        connect();
        $name=$_POST['name'];
        $user = mysql_real_escape_string($_POST['user']);
        $check_for_username = mysql_query("SELECT user from userpage WHERE user = '$user'");
        $count = mysql_num_rows($check_for_username);
        if($count != 0)
        {

            form($name,$user);
        }
        }
    }
    /*function insert()
{
    connect();
    if(isset($_POST['submit']))
    {
        usercheck();
        $name=$_POST['name'];
        $user=$_POST['user'];
        $sql1= "INSERT INTO userpage (name,user) VALUES ('$name','$user')";
        mysql_query($sql1);
    }

}*/
?>
View Answers









Related Tutorials/Questions & Answers:
value in div from php, reloading form
value in div from php, reloading form  I am having one form with name... woth other login.php <?php include 'login2.php'; function form($name..." name="name" value="<?php echo $name?>" required></td></tr>
Return Value from One Form
Return Value from One Form  I have two buttons in main form client and bank.when i click client button new form will open, in this dedupe button... value of dedupe form and use in bank form..how to do
Advertisements
Fetch the data from mysql and display it on php form
Fetch the data from mysql and display it on php form  when i press on login button, after succesful login the related data of that person should be display in other textbox
Retrieve value of radio button from database to form
Retrieve value of radio button from database to form  var gn=document.getElementsByName("empg"); //empg is name of radio input type. for(var i=0;i
PHP form
PHP form  Hi Sir/Madam, I am developing an attendance form using php, which displays the name and ID of a Employees which are fetched from Db and I... form and update them to respective coloumn... Please any one help mo out please
PHP Form, PHP guest form
PHP email form HTML form It's not a good idea to leave your private e...;br> </form><br> <?php //php-code from the Part 2<br>... (value) match their purpose. The action attribute of form tag links to itself, so
php form post to mysql
php form post to mysql  How to post data into mysql database from the PHP post data form
checkbox value in php
checkbox value in php  In my HTML,PHP form ..we have a check box that is working fine. But anyhow i am not able to get the value of it. Can anyone suggest how to get the value of checkbox in PHP
Expand / Collapse form div when click on button
Expand / Collapse form div when click on button  Hi, I have a form integrated from Wufoo with iFrame code. If the user misses a field an error... formbox expand once the form gets higher? Thanks <div class="formbox
displaying data for a single column from Mysql database in the list box in php form
displaying data for a single column from Mysql database in the list box in php form  I have a form in php.want to display data from a single column...('include/functions.php'); $Select = "SELECT * FROM category_master"; $Q = mysql
PHP Array get key from value
In php array one can get the key from value by the use of array_search function Array_search function searches the key for the given values in the array. Example of PHP Array Get Key from Value <?php $product=array
PHP Form
PHP Form In this tutorial you will learn how to pass any data from a html page to a php file, and how to use all those data. To do this we need at least two files one is html file and a php file. Here's the given example
HTML to php form
HTML to php form  Hi, How I can submit the HTML form data to PHP Script? Give me example code. Thanks   Hi, Please see the following tutorials: PHP Form PHP email form Thanks
Drag from DIV overflow - Ajax
Drag from DIV overflow  Hello All, I have Two html DIVs to use. What i want to do is click and drag item from First DIV and drop in Second DIV... from First Div, this item which i drag did not go beyound from Frist Div. How
PHP Sticky form problem
PHP Sticky form problem  I have done the full coding of a sticky form...="text" name="number1" size="20" value="<?php if(isset($_POST['number1'])) echo..." name="number2" size="20" value="<?php if(isset($_POST['number2'])) echo
PHP Sticky form problem
PHP Sticky form problem  I have done the full coding of a sticky form...: <input type="text" name="number1" size="20" value="<?php if(isset($_POST...;input type="text" name="number2" size="20" value="<?php if(isset($_POST
PHP JavaScript form Validation - PHP
PHP JavaScript form Validation  Just looking for a general PHP JavaScript form Validation. How can I write external JavaScript Validation? Please suggest!  Hi Friend, 1) form Enter Name Enter Address
php array sort by value
php array sort by value  an example to sort the array by value
php loging form connecitivity with mysql
php loging form connecitivity with mysql  my loging form is not connect
How to change value of div using Ajax in struts.
How to change value of div using Ajax in struts. In this example, we will introduce you to how to change value of div tag using Ajax in struts, without reloading page.  1-index.jsp <%@ page contentType="text/html
php array loop key value
php array loop key value  How to use Array key value loop in PHP
Custom Form Validation - PHP
Custom Form Validation  Which is the best way or where should I implement the custom validation rules such as ? using number, capital letters and symbols to secure the password
assign value problums in php
assign value problums in php  I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what?s the problem
how to post data in mysql php form
how to post data in mysql php form  how to post data in mysql php form
PHP HTML Form
PHP & HTML Form: In the current tutorial we will study about PHP and HTML form, we will see how to send HTML . We will combine one html file and PHP...;form method="get" action="<?php $_SERVER['PHP_SELF'
php form having 2 submit buttons
php form having 2 submit buttons  i have a php form and some text boxes.and 2 buttons"approve" and "disapprove". when i click on approve button the data from form should go in mysql database and mail should go to appropiate
how to create a user registration form in php
how to create a user registration form in php  how to create a user registration form in php
PHP Form Part-1
Topic : HTML FORM Part - 1  In this tutorial, we will learn how to deal with Html Form, JavaScript Validation, MySQL Database and PHP Scripts. We... form starts from the Body tag. In the <body> tag we have taken  <
Reading Value From console
Reading Value From console  In case of String data Type readLine method of DataInputStream class read complete line of the given string but the next method of Scanner class doesn't read the complete line of String. why
Reading Value From console
Reading Value From console  In case of String data Type readLine method of DataInputStream class read complete line of the given string but the next method of Scanner class doesn't read the complete line of String. why
PHP : Form to Email
PHP : Form to Email       With the help of this tutorial you can send mails to a user using a form, as we have..._TO_REPLACE_8 { ?> <form name="mail" action="<?php
PHP Value Sorting
PHP Sort By Value: PHP provides many functions to sort an array. We can sort an array by value, key or randomly. But in most of the situations we need to sort an array by value. There are so many functions are available in PHP, some
PHP list box mysql
PHP List box that displays the data from mysql table. User can select any value from the PHP list box. Example of PHP MYSQL List Box Code <... <form action='<?php echo $_SERVER['PHP_SELF'];?>'> <select
Pass values from form to form
Pass values from form to form       Java program to pass values from one form to another form in JSP There are many occasions when the programmer need to pass some value to many
export value in csv from jsp
export value in csv from jsp  Hi! i have creted a html form using javascript. i hv taken the array values in jsp. nw i want to pass these array values from jsp to csv file. so please help me how to send
returning a value from Threads
returning a value from Threads  Hello I have worker pattern that uses ExecutorService to schedule Thread execution but getting stuck at some point when returning a value using Future.I have code snippet below: ExecutorService
php download file from ftp
php download file from ftp  Need to download files from ftp using php. a simple example
php download file from url
php download file from url  how to download multiple files in PHP using the URL's
Get form value in same page - JSP-Servlet
Get form value in same page  Hello friends, Can we get a form field value in the same to be processed in java coding...-registration-form-using-jsp.shtml Thanks
PHP MySQL Login Form
Login Form using PHP and MySQL: In any website generally it is mandatory to have a login form to keep your data secure. In this regard we need to have... will study how to create a login form, connect with the database server and login
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list... value="">--- Select ---</option> </div> <?php mysql_connect
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list... value="">--- Select ---</option> </div> <?php mysql_connect
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list... value="">--- Select ---</option> </div> <?php mysql_connect
passing value from javascript popup
passing value from javascript popup  How to take user input and pass that input value using popup in Javascript
remove comma from string php
remove comma from string php  How to remove the last comma from the string in PHP
upload value to php server in getmethod in j2me
upload value to php server in getmethod in j2me  Dear Team, I... getting that value i means captured decoded value i want to that value in get method to php server in j2me can you give some tips for me... Thanks and Regards
swings:how to link from one form to another form
swings:how to link from one form to another form  how to link from one form to another form
PHP SQL Fetch
PHP SQL Fetch       PHP SQL Fetch is used to fetch the records from Mysql database to PHP..._TO_REPLACE_1 The Tutorial illustrate an example from PHP SQL Fetch. To understand
read value from database & alert it is available in database or not
read value from database & alert it is available in database or not  how to read value from text box and alert whether it is available in database...="text/javascript"> function check(value){ xmlHttp=GetXmlHttpObject() var
ModuleNotFoundError: No module named 'reloading'
ModuleNotFoundError: No module named 'reloading'  Hi, My Python... 'reloading' How to remove the ModuleNotFoundError: No module named 'reloading' error? Thanks   Hi, In your python environment you

Ads