-2

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'>&nbsp;</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>
Peon
  • 7,902
  • 7
  • 59
  • 100
  • 1
    `" value='']."'"` – `" value='']."` is a valid text literal, after that comes stuff that the interpreter can not understand because it violates PHP syntax. Please go learn the _basics_ of PHP string syntax! – CBroe Nov 13 '13 at 07:49

4 Answers4

0
<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?

Community
  • 1
  • 1
Luceos
  • 6,629
  • 1
  • 35
  • 65
0

Rewrite line this like

  <input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) ? " value='".$_POST['email']."'" : "");?>>
Bindiya Patoliya
  • 2,726
  • 1
  • 16
  • 15
0

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'];?>" >
0

replace this line by

<input type='email' name='email' id='email' tabindex="1" class='login_form_input'<?=(isset($_POST['email']) /? " value='']."'" : "");?>
alok.kumar
  • 380
  • 3
  • 11