Link to home
Start Free TrialLog in
Avatar of aej1973
aej1973

asked on

error on a specific line ...

When I run this code I keep getting a syntax error, can someone let me know what the issue could be?

echo       '<input type="radio" name="status" value="1" id="status_1"'.if($row['visit_status'] == '1'){echo 'checked';}.'/>Complete</label>';

The error message I get is:

Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\module_p\editSchedule.php on line 78

Thanks for the help.

A
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Unexpected in a PHP parse error means that something is wrong up the script above the line number location of the of the parse error.  Maybe the error is in the same line or a line above it.
Maybe try changing the dot to a semi-colon.
I would probably code it this way.
<?php // RAY_temp_aej1973.php

$x = '<input type="radio" name="status" value="1" id="status_1"';
if($row['visit_status'] == '1')
{
    $x .= ' checked';
}
$x .= '/>Complete</label>';
echo $x;

Open in new window

http://www.laprbass.com/RAY_temp_aej1973.php
ASKER CERTIFIED SOLUTION
Avatar of karunamoorthy
karunamoorthy
Flag of India 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 aej1973
aej1973

ASKER

karunamoorthy, perfect! This is what I was looking for.

A
Avatar of aej1973

ASKER

Thanks.