This is part of my PHP code, and inside of it there is an echo that will print some HTML code, with the onblur
and onfocus
conditions. This code works when it's outside of echo
but not inside of it.
I already tried to add the double quotes on the first input
in my code (Username
field) but it still doesn't work...
Any ideas?!
elseif ($_GET['register'] == "true"){ echo "
<div class='index_register'>
Register to Play or <a href='login.php'>login</a>
<p></p>
<!-- Registration Form -->
<form action='?do=register' method='post' autocomplete='off'>
<input class=\"input_reg\" type=\"text\" name=\"username\" size=\"40\" maxlength=\"12\" value=\"Username\" onblur=\"if (this.value == \"\") {this.value = \"Username\";}\" onfocus=\"if (this.value == \"Username\") {this.value = \"\";}\">
<input class='input_reg' type='text' name='email' size='40' maxlength='50' value='Email Address' onblur='if (this.value == '') {this.value = 'Email Address';}' onfocus='if (this.value == 'Email Address') {this.value = '';}'>
<input class='input_reg' type='password' name='password' size='40' maxlength='12' value='Password' onblur='if (this.value == '') {this.value = 'Password';}' onfocus='if (this.value == 'Password') {this.value = '';}'>
<input class='submit' type='submit' value='Register' name='Register'>
</form>
</div>
"; }
This code works when it's outside of echo but not inside of it.
don't use echo then
elseif ($_GET['register'] == "true"){
?>
<div class='index_register'>
Register to Play or <a href='login.php'>login</a>
<p></p>
<!-- Registration Form -->
<form action='?do=register' method='post' autocomplete='off'>
...
</form>
</div>
<?
}