value in div from php, reloading form

Ads
 

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

Ads









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 post to mysql
php form post to mysql  How to post data into mysql database from the PHP post data form
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
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
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
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
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
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 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 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 post data in mysql php form
how to post data in mysql php form  how to post data in mysql php form
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
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
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... value mail will be sent. Code: <?php $to=$sub=$msg=$hdr="
remove comma from string php
remove comma from string php  How to remove the last comma from the string in PHP
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
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
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
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
store html value in the sqllite 3 php
store html value in the sqllite 3 php  i have a php script...'); //PHP Simple HTML DOM Parser library $html = file_get_html('www.website.com... tell db to store html content from $articles $result = $db->query('SELECT bar

Ads