Link to home
Start Free TrialLog in
Avatar of lilyyan
lilyyan

asked on

use .innerHTML in a echo statement in a php file

hello

this is two file i used
------------------------
testform.php
<form method="post" action="doForm" >
user name <input type="text" name="userName" id="userNameID" />
<span id="userConfirm"></span>
<input type="submit" value="Submit">
---------------------------

doForm.php
if the user name doesn't exist, then i use the following two line:
--------------------------------------------------
if ( username doesn't exist) {
include("testform.php");
        echo "<script language=Javascript>
        document.getElementById('userConfirm').innerHTML='User Name doesn't exist.';
        </script>";
}
----------------------------------------------------
the javascript doesn't work. seems like there is some error in the js file.
any suggestion about this?

Thanks very much,
lilyyan
ASKER CERTIFIED SOLUTION
Avatar of darron_chapman
darron_chapman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lilyyan
lilyyan

ASKER

works great ! thanks a lot !

is that possible when user start to type, set the $messsage="" ?

user onkeyDown action or other action?
Avatar of lilyyan

ASKER

namely, when user's first time input is incorrect and need to try again on the testform.php page
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lilyyan

ASKER

Great! Thanks a lot!