I am getting error on line 7 syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
<div id='login_form_container'>
<div class='dInlineB' align="left">
<label class='login_form_label' for='email'>Email:</label>
<input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='']."'" : "");?>
</div>
<div class='dInlineB' align="left">
<label class='login_form_label' for='password'>Password:</label>
<input type='password' name='password' id='password' tabindex="2" class='login_form_input' />
</div>
<div align="left">
<div class='login_form_spacer'> </div>
<div class='dInline fs11'>
<label for='login_form_stay'>
<input type='checkbox' name='stayLogged' tabindex="3" checked='checked' value='1' id='login_form_stay' />
Keep me logged in
</label>
</div>
<input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='']."'" : "");?>
is malformed, please see the following correct line:
<input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='".$_POST['email']."'" : "");?>>
Code highlighting here on SO already shows where your error is at. What you missed was adding the value from $_POST
to your input. In order to add PHP variable in a string you have to append the PHP like this: "this is a string" . $variable . " continued string"
or with single quotes: 'this is a string' . $variable . ' continued string'
.
Using double or single quotes depends on whether you want to be able to use variables inline as well, which works on double, but not on single quotes: "this $variable works inline" . 'but the $variable doesn\'t work here'
. For more info about the double/single quotes: What is the difference between single-quoted and double-quoted strings in PHP?
Rewrite line this like
<input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='".$_POST['email']."'" : "");?>>
You can replace :
<input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='']."'" : "");?>
with :
<input type='email' name='email' id='email' tabindex="1" class='login_form_input'value="<?php if(isset($_POST['email'])) echo $_POST['email'];?>" >
replace this line by
<input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) /? " value='']."'" : "");?>