Solved

error on a specific line ...

Posted on 2012-04-13
6
197 Views
Last Modified: 2012-04-13
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
0
Comment
Question by:aej1973
  • 3
  • 2
6 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37843935
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.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37843939
Maybe try changing the dot to a semi-colon.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37843954
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
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 7

Accepted Solution

by:
karunamoorthy earned 150 total points
ID: 37843986
This is what you want;

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

Author Comment

by:aej1973
ID: 37844100
karunamoorthy, perfect! This is what I was looking for.

A
0
 

Author Closing Comment

by:aej1973
ID: 37844107
Thanks.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question