-5

Im trying to repopulate my form but this error is shown

Parse error: syntax error, unexpected 'set_value' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\groupie\application\views\register.php on line 31

Here is my code

echo '<div class="form-group has-error">
    <label class="control-label" for="inputError">School ID:</label>
    <input type="text" class="form-control" name="inputSchoolID" id="inputError" value="'set_value('inputSchoolID')';">
    <span class="help-block">'. form_error('inputSchoolID') .'</span>
</div>';

This is the part where it errors

value="'set_value('inputSchoolID')';"

llanato
  • 2,508
  • 6
  • 37
  • 59
Cronas De Se
  • 331
  • 4
  • 21
  • You need to learn how to format code and make use of the correct " and ' and perhaps make use of \" and \' – Naruto Oct 02 '15 at 09:47

3 Answers3

0

There are missing dots, change it like in your form_error:

echo '<div class="form-group has-error">
    <label class="control-label" for="inputError">School ID:</label>
    <input type="text" class="form-control" name="inputSchoolID" id="inputError" value="' . set_value('inputSchoolID') . ';">
    <span class="help-block">'. form_error('inputSchoolID') .'</span>
</div>';
danopz
  • 3,310
  • 5
  • 31
  • 42
0

My mistake I forgot to put periods. It should be

value = " ' . set_value('inputSchoolID') . '; "

Cronas De Se
  • 331
  • 4
  • 21
0

You missed the concatenation dots (.)

echo '<div class="form-group has-error">
                        <label class="control-label" for="inputError">School ID:</label>
                        <input type="text" class="form-control" name="inputSchoolID" id="inputError" value="'.set_value('inputSchoolID').';">
                        <span class="help-block">'. form_error('inputSchoolID') .'</span>
                        </div>';
Mohan
  • 4,677
  • 7
  • 42
  • 65